Add disk or mount point to Oracle RAC
How to add disk to Oracle RAC servers as OCFS2
500GB Disk partition has added from SAN to all four nodes for Database Logical Backup.
How to Detect a New Hard Disk without Rebooting Linux Servers
This command is very intelligent, it will detect new created partition without reboot.
#ls /sys/class/scsi_host/ | while read host ; do echo "- - -" > /sys/class/scsi_host/$host/scan ; done
check is it detected by multipath
[root@rac1 ~]# multipath -ll mpathb (360014380125db6ff0000700000c50000) dm-26 HP,HSV340 è this is the New partition size=500G features='0' hwhandler='0' wp=rw |-+- policy='round-robin 0' prio=1 status=active | `- 2:0:2:14 sdbb 67:80 active ready running |-+- policy='round-robin 0' prio=1 status=enabled | `- 2:0:3:14 sdbc 67:96 active ready running |-+- policy='round-robin 0' prio=1 status=enabled | `- 3:0:1:14 sdbe 67:128 active ready running `-+- policy='round-robin 0' prio=1 status=enabled `- 3:0:0:14 sdbd 67:112 active ready running I removed the other disks print [root@rac1 ~]#
Added the entry to multipath.conf file
multipaths { multipath { wwid 360014380125db6ff0000700000c50000 alias rman path_grouping_policy group_by_prio path_selector "round-robin 0" failback immediate rr_weight uniform no_path_retry 10 } [root@rac1 ~]#
Restart Multipath Service
[root@rac1 ~]# /etc/init.d/multipathd restart Stopping multipathd daemon: [ OK ] Starting multipathd daemon: [ OK ] [root@rac1 ~]#
Check again for new disk detection named rman
[root@rac1 ~]# dmsetup ls | sort ASMDATA1 (253, 11) ASMDATA1p1 (253, 22) Backup-archive (253, 9) Backup-archivep1 (253, 21) OCR_DISK1 (253, 4) OCR_DISK1p1 (253, 14) OCR_DISK2 (253, 5) OCR_DISK2p1 (253, 20) OCR_DISK3 (253, 3) OCR_DISK3p1 (253, 19) rman (253, 26) [root@rac1 ~]#
Confirmed the disk in mapper
[root@rac1 ~]# ls -l /dev/mapper/ total 0 brw-rw---- 1 root disk 253, 11 Jun 26 06:45 ASMDATA1 brw-rw---- 1 root disk 253, 22 Jun 26 06:45 ASMDATA1p1 brw-rw---- 1 root disk 253, 4 Jun 26 06:45 OCR_DISK1 brw-rw---- 1 root disk 253, 14 Jun 26 06:45 OCR_DISK1p1 brw-rw---- 1 root disk 253, 5 Jun 26 06:45 OCR_DISK2 brw-rw---- 1 root disk 253, 20 Jun 26 06:45 OCR_DISK2p1 brw-rw---- 1 root disk 253, 3 Jun 26 06:45 OCR_DISK3 brw-rw---- 1 root disk 253, 19 Jun 26 06:45 OCR_DISK3p1 brw-rw---- 1 root disk 253, 26 Jul 31 16:42 rman [root@rac1 ~]#
To mount the new disk you to make a partition of it. Now Creating disk partition
[root@rac1 ~]# fdisk /dev/mapper/rman Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. The number of cylinders for this disk is set to 65270. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): p Disk /dev/mapper/rman: 536.8 GB, 536870912000 bytes 255 heads, 63 sectors/track, 65270 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-65270, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-65270, default 65270): Using default value 65270 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 22: Invalid argument. The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks. [root@rac1 ~]#
Confirm partition is created
[root@rac1 ~]# fdisk -l /dev/mapper/rman Disk /dev/mapper/rman: 536.8 GB, 536870912000 bytes 255 heads, 63 sectors/track, 65270 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/mapper/rmanp1 1 65270 524281243+ 83 Linux [root@rac1 ~]#
Formatting as ocfs2
[root@rac1 ~]# mkfs.ocfs2 -b 4k -C 32k -L rman /dev/mapper/rmanp1 mkfs.ocfs2 1.6.3 Cluster stack: classic o2cb Label: rman Features: sparse backup-super unwritten inline-data strict-journal-super Block size: 4096 (12 bits) Cluster size: 32768 (15 bits) Volume size: 536863965184 (16383788 clusters) (131070304 blocks) Cluster groups: 508 (tail covers 29996 clusters, rest cover 32256 clusters) Extent allocator size: 67108864 (16 groups) Journal size: 268435456 Node slots: 8 Creating bitmaps: done Initializing superblock: done Writing system files: done Writing superblock: done Writing backup superblock: 5 block(s) Formatting Journals: done Growing extent allocator: done Formatting slot map: done Formatting quota files: done Writing lost+found: done mkfs.ocfs2 successful [root@rac1 ~]#
Add the line to fstab and create directory so that it can be auto mount
1st create the mount
[root@rac1 ~]#mkdir /logical-backup [root@dbsr113 ~]# vi /etc/fstab And add the below line /dev/mapper/rmanp1 /logical-backup ocfs2 datavolume,nointr 0 0 [root@rac1 ~]#
To mount the disk read from fstab command is mount -a
[root@rac1 ~]# mount –a
Check and confirm
[root@rac1 ~]# df -h /logical-backup/ Filesystem Size Used Avail Use% Mounted on /dev/mapper/rmanp1 500G 2.6G 498G 1% /logical-backup [root@rac1 ~]#
It is done
Configure Backup to New Mount point:
[root@rac1 ~]# mkdir /logical-backup/backup-dg [root@rac1 ~]# chmod -R 775 /logical-backup/backup-dg/ [root@rac1 ~]# chown -R oracle:oinstall /logical-backup/backup-dg/ [root@rac1 ~]# ls -rlt /logical-backup/ total 0 drwxr-xr-x 2 root root 3896 Jul 31 17:39 lost+found drwxrwxr-x 2 oracle oinstall 3896 Jul 31 18:04 backup-dg [root@rac1 ~]#
Create directory backup
SQL> create directory logical as '/logical-backup/backup-dg'; Directory created. SQL> grant read,write on directory logical to system; Grant succeeded. SQL> backup.sh script expdp system/password parallel=4 dumpfile=Full_database_backup%U.dmp logfile=Full_database_backup.log directory=logical full=y
Add the backup to crontab to run everyday on 10:30PM
[oracle@rac1 script]$ crontab -l 30 22 * * * /home/oracle/script/backup.sh > /backup/datapump/backuplog.txt 2>&1
Shared on the backup directory to SAMBA as well.
[export] comment = export path = /logical-backup/backup-dg public = yes writable = yes browseable = yes inherit permissions = Yes printable = no guest ok = yes directory mask = 0777 create mask = 0777
Comments
Post a Comment