Pages

Tuesday, January 12, 2016

NFS. Tricks in OVM

http://www.oracle.com/technetwork/server-storage/vm/ovm3-demo-vbox-1680215.pdf


STARTING NFS QUOTAS: CANNOT REGISTER SERVICE: RPC: UNABLE TO RECEIVE; ERRNO = CONNECTION REFUSED

While trying to setup NFS on an OVM 3.2 configuration on OEL 5.9, I followed the documentation to the letter but when time came to start the NFS daemon I kept getting the error above.
1
2
3
4
5
6
[root@ovm /]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
[FAILED]
Starting NFS daemon: [FAILED]
After a little googling, it turns out that RPCBind may not be running.
1
2
[root@ovm /]# rpcinfo -p
rpcinfo: can't contact portmapper: RPC: Remote system error - Connection refused
Perhaps I needed to update my NFS Utility packages?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
[root@ovm /]# yum install nfs-utils
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
You can use up2date --register to register.
ULN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.0.9-70.el5 set to be updated
--> Processing Dependency: initscripts >= 8.45.43 for package: nfs-utils
--> Running transaction check
---> Package initscripts.x86_64 0:8.45.44-3.0.1.el5 set to be updated
--> Finished Dependency Resolution
 
Dependencies Resolved
 
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Updating:
nfs-utils x86_64 1:1.0.9-70.el5 el5_latest 409 k
Updating for dependencies:
initscripts x86_64 8.45.44-3.0.1.el5 el5_latest 1.6 M
 
Transaction Summary
=============================================================================================================================================================
Install 0 Package(s)
Upgrade 2 Package(s)
 
Total download size: 2.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): nfs-utils-1.0.9-70.el5.x86_64.rpm | 409 kB 00:00
(2/2): initscripts-8.45.44-3.0.1.el5.x86_64.rpm | 1.6 MB 00:01
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 598 kB/s | 2.0 MB 00:03
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : initscripts 1/4
warning: /etc/sysctl.conf created as /etc/sysctl.conf.rpmnew
Updating : nfs-utils 2/4
Cleanup : nfs-utils 3/4
Cleanup : initscripts 4/4
 
Updated:
nfs-utils.x86_64 1:1.0.9-70.el5
 
Dependency Updated:
initscripts.x86_64 0:8.45.44-3.0.1.el5
 
Complete!
Then I tried the RPC info command again, but no luck!
1
2
[root@ovm /]# rpcinfo -p
rpcinfo: can't contact portmapper: RPC: Remote system error - Connection refused
Portmap? Oh, that would explain a lot since NFS apparently requires port mapper service to run.
1
2
[root@ovm /]# chkconfig portmap on
[root@ovm yum.repos.d]# service portmap start
Try RPC info again. Aha, that did it!
1
2
3
4
[root@ovm yum.repos.d]# rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
Finally, restart the NFS Service and set it to autostart.
1
2
3
4
5
6
[root@ovm /]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@ovm /]# chkconfig nfs on
Hope this was helpful!
Cheers!

Monday, January 11, 2016

Rename or Relocate Datafile

1.
ALTER TABLESPACE users OFFLINE NORMAL;
2.
ALTER TABLESPACE users
    RENAME DATAFILE '/u02/oracle/rbdb1/user1.dbf',
                    '/u02/oracle/rbdb1/user2.dbf'
                 TO '/u02/oracle/rbdb1/users01.dbf',
                    '/u02/oracle/rbdb1/users02.dbf';
3.
SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME = 'USERS';
4.
Copy the datafiles to their new locations and rename them using the operating system.
5.
ALTER TABLESPACE users
    RENAME DATAFILE '/u02/oracle/rbdb1/users01.dbf',
                    '/u02/oracle/rbdb1/users02.dbf'
                 TO '/u03/oracle/rbdb1/users01.dbf',
                    '/u04/oracle/rbdb1/users02.dbf';

Thursday, January 7, 2016

Format Disk then Mount Disk

show current disk format
df -T

list all the drives, including unformatted:
(run as root)
fdisk -l| grep '^Disk'

root: run blkid to find uuid


Linux Hard Disk Format Command


Q. I've installed a new 250GB SATA hard disk on our office CentOS Linux server. How do I format a hard disk under Linux operating system from a shell prompt?

A.. There are total 4 steps involved for hard disk upgrade and installation procedure:



Step #1 : Partition the new disk using fdisk command

Following command will list all detected hard disks:
# fdisk -l | grep '^Disk'
Output:
Disk /dev/sda: 251.0 GB, 251000193024 bytes
Disk /dev/sdb: 251.0 GB, 251000193024 bytes
A device name refers to the entire hard disk. For more information see Linux partition naming convention and IDE drive mappings.
To partition the disk - /dev/sdb, enter:
# fdisk /dev/sdb
The basic fdisk commands you need are:
  • m - print help
  • p - print the partition table
  • n - create a new partition
  • d - delete a partition
  • q - quit without saving changes
  • w - write the new partition table and exit

Step#2 : Format the new disk using mkfs.ext3 command

To format Linux partitions using ext2fs on the new disk:

# mkfs.ext3 /dev/sdb1

mkfs.ext4 /dev/sdaX



Step#3 : Mount the new disk using mount command

First create a mount point /disk1 and use mount command to mount /dev/sdb1, enter:
# mkdir /disk1
# mount /dev/sdb1 /disk1
# df -H

Step#4 : Update /etc/fstab file

Open /etc/fstab file, enter:
# vi /etc/fstab
Append as follows:
/dev/sdb1               /disk1           ext3    defaults        1 2
Save and close the file.

Task: Label the partition

You can label the partition using e2label. For example, if you want to label the new partition /backup, enter
# e2label /dev/sdb1 /backup
You can use label name insted of partition name to mount disk using /etc/fstab:
LABEL=/backup /disk1 ext3 defaults 1 2





 


Create Schema

SQL> create tablespace GGODS datafile 'GGODS.dat' size 100M autoextend on;
Tablespace created.
SQL> create user ggods identified by ggods  default tablespace GGODS;
User created.
SQL> grant connect to ggods;
Grant succeeded.
SQL> grant resource to ggods;
Grant succeeded.
SQL> conn ggods/ggods
Connected.

CREATE SCHEMA AUTHORIZATION oe
   CREATE TABLE new_product 
      (color VARCHAR2(10)  PRIMARY KEY, quantity NUMBER) 
   CREATE VIEW new_product_view 
      AS SELECT color, quantity FROM new_product WHERE color = 'RED' 
   GRANT select ON new_product_view TO hr;