Thursday, February 6, 2020

gDBClone Master/GOLD copy and SNAP database creation high level steps

gDBClone Master/GOLD copy and SNAP database creation high level steps
==========================================================

https://www.oracle.com/downloads/samplecode/gdbclone-samplecode-downloads.html

Master DB name: GOLDDB
Master OH: /u01/app/oracle/product/11.2.0.4/GOLDDB

SNAP DB name: SNAPDB
SNAP OH: /u01/app/oracle/product/11.2.0.4/SNAPDB

1) *** rpm install on all db nodes  
rpm -i gDBClone-3.0.2-64.noarch.rpm 
cd /opt/gDBClone/
ls -ltrh
cd lib/
ls -ltrh

--- Please refer my blog for “rpm installation”

2) ***user creation oragold (considering oragold as our OS user)
--- Please refer my blog for “OS user creation and assigning primary and secondary group”

3) ***enable passwordless ssh for oragold 
--- Please refer my blog for “How to enable passwordless ssh equivalence”

4) ***DB home clone EBSGOLD
--- Please refer my blog for “Oracle Home cloning”

5) ***post validation GOLDDB OH 
/opt/gDBClone/gDBClone listhomes

6) ***Create an encrypted SYS password file (Not Mandatory)

sudo /opt/gDBClone/gDBClone syspwf -syspwf /opt/gDBClone/SYSpasswd_file
more /opt/gDBClone/SYSpasswd_file

***** gDBClone master copy can be created using active database or rman backup *****

7) ***Clone the DB from Active database - We are not following this steps to build EBSGOLD 

sudo /opt/gDBClone/gDBClone clone -sdbname PRODDB \
-sdbscan scan-name \
-tdbname GOLDDB \
-tdbhome 11204_GOLDDB_Home \
-dataacfs /acfsmounts/acfs1
-syspwf /opt/gDBClone/SYSpasswd_file 

8) ***Clone the DB from PRODDB database backup - This is step we are followed to build GOLDDB

sudo /opt/gDBClone/gDBClone clone -sdbname EBSDBA -sbckloc '/zfs-10G/orabknp2/EBSDBA/RMAN_Full_DB_Backup/Fri/Apr272018' -tdbname EBSDBGLD -tdbhome EBSDBA1_DB__u01_app_oracle_product_11_2_0_4_EBSDBA_ -dataacfs /acfsmounts/acfs1

9) ***List cloned DBs
/opt/gDBClone/gDBClone listdbs


10) ***DB home clone SNAPDB
--- Please refer my blog for “Oracle Home cloning”

11) ***post validation SNAPDB OH 
/opt/gDBClone/gDBClone listhomes

12) ***Creat SNAP database EBSSNAP from GOLDDB
sudo /opt/gDBClone/gDBClone snap -sdbname GOLDDB -tdbname SNAPDB -racmode 2

sudo /opt/gDBClone/gDBClone snap -sdbname GOLDDB -tdbname SNAPDB -tdbhome 11204_SNAPDB_Home
 -racmode 2

Note: You can install separate Oracle home for SNAPDB or you can install SNAPDB database on GOLDDB Oracle home

13) ***List cloned DB

/opt/gDBClone/gDBClone listdbs
sudo /opt/gDBClone/gDBClone listdbs -tree

14) *** DB size Verifications

SELECT a.data_size + b.temp_size + c.redo_size + d.controlfile_size 
"total_size in GB" 
FROM (SELECT SUM (bytes) / 1024 / 1024/1024 data_size FROM dba_data_files) a, 
(SELECT NVL (SUM (bytes), 0) / 1024 / 1024/1024 temp_size 
FROM dba_temp_files) b, 
(SELECT SUM (bytes) / 1024 / 1024/1024 redo_size FROM sys.v_$log) c, 
(SELECT SUM (BLOCK_SIZE * FILE_SIZE_BLKS) / 1024 / 1024/1024 
controlfile_size 
FROM v$controlfile) d;

14) *** gDBClone_GOLD_and_SNAP_DB_Creation_RunBook_Logs

GOLDDB installation steps
=====================
[root@na2exdbadm03sp ~]# /opt/gDBClone/gDBClone clone -sdbname PRODDB -sbckloc '/zfs-IB-10g/orabkp2/PRODDB/RMAN_Full_DB_Backup/DEC082018' -tdbname GOLDDB -tdbhome 11204_GOLDDB -dataacfs /acfsmounts/acfs1 -channels 48 pfile=/u01/app/oracle/product/11.2.0.4/GOLDDB/dbs/initGOLDDB.ora
INFO: 2019-02-01 04:36:51: Please check the logfile '/opt/gDBClone/out/log/gDBClone_253486.log' for more details

MacroStep1 - Getting information and validating setup...

Please enter the 'SYS' User password for the database PRODDB:
Please re-enter the 'SYS' user password for the database PRODDB:
INFO: 2019-02-01 04:37:07: Validating environment
INFO: 2019-02-01 04:37:07: Checking superuser usage
INFO: 2019-02-01 04:37:07: Checking if target database name 'GOLDDB' is a valid name
INFO: 2019-02-01 04:37:07: Checking if target database home '11204_GOLDDB' exists
INFO: 2019-02-01 04:37:07: Checking if Oracle Restart
INFO: 2019-02-01 04:37:07: Checking source backup location /zfs-IB-10g/orabkp2/PRODDB/RMAN_Full_DB_Backup/DEC082018...
INFO: 2019-02-01 04:37:07: Getting ORACLE_BASE path from orabase
INFO: 2019-02-01 04:37:07: Checking if target database 'GOLDDB' exists
INFO: 2019-02-01 04:37:08: Checking 'GOLDDB' snapshot existence on '/acfsmounts/acfs1'
INFO: 2019-02-01 04:37:08: Checking registered instance 'GOLDDB'
sh: /u01/app/oracle/product/11.2.0.4/EBSXSIT/bin/srvctl: No such file or directory
Use of uninitialized value in split at /opt/gDBClone/lib/gDBClone_Utils.pm line 864.
Use of uninitialized value $data in scalar chomp at /opt/gDBClone/lib/gDBClone_Utils.pm line 1426.
Use of uninitialized value $data in substitution (s///) at /opt/gDBClone/lib/gDBClone_Utils.pm line 1427.
Use of uninitialized value $data in substitution (s///) at /opt/gDBClone/lib/gDBClone_Utils.pm line 1427.
sh: /u01/app/oracle/product/11.2.0.4/OBIXSIT/bin/srvctl: No such file or directory
Use of uninitialized value in split at /opt/gDBClone/lib/gDBClone_Utils.pm line 864.
Use of uninitialized value $data in scalar chomp at /opt/gDBClone/lib/gDBClone_Utils.pm line 1426.
Use of uninitialized value $data in substitution (s///) at /opt/gDBClone/lib/gDBClone_Utils.pm line 1427.
Use of uninitialized value $data in substitution (s///) at /opt/gDBClone/lib/gDBClone_Utils.pm line 1427.
INFO: 2019-02-01 04:37:16: Checking listener on 'scan-name:1521'
INFO: 2019-02-01 04:37:16: Checking ACFS command options
INFO: 2019-02-01 04:37:16: Checking if '/acfsmounts/acfs1' is an ACFS file system
SUCCESS: 2019-02-01 04:37:18: Environment validation complete

MacroStep2 - Setting up clone environment...
INFO: 2019-02-01 04:37:18: Creating local pfile
INFO: 2019-02-01 04:37:18: Creating local password file
INFO: 2019-02-01 04:37:18: Creating local Audit folder
INFO: 2019-02-01 04:37:18: Creating local auxiliary listener
INFO: 2019-02-01 04:37:18: Starting auxiliary listener
INFO: 2019-02-01 04:37:18: Sleeping 60 secs, please wait
INFO: 2019-02-01 04:38:18: Setting up ACFS storage
INFO: 2019-02-01 04:38:18: Creating dynamic scripts
INFO: 2019-02-01 04:38:21: Cloning to target ACFS from backup location '/zfs-IB-10g/orabkp2/PRODDB/RMAN_Full_DB_Backup/DEC082018'
INFO: 2019-02-01 04:38:21: Creating RMAN script for spfile target to ACFS
INFO: 2019-02-01 04:38:21: Instantiating clone database
SUCCESS: 2019-02-01 04:38:21: Environment setup complete

MacroStep3 - Cloning database 'PRODDB'...
INFO: 2019-02-01 04:38:21: Database clone in progress, please wait
INFO: 2019-02-01 04:38:21:    (this can take a while depending on database size and/or network speed)

INFO: 2019-02-02 04:45:17: Cloned database restore until SCN:6080823915294 done successfully
INFO: 2019-02-02 04:45:17: Moving spfile
INFO: 2019-02-02 04:45:59: Register 'GOLDDB' database as cluster resource
INFO: 2019-02-02 04:46:01: Updating spfile
INFO: 2019-02-02 04:46:04: Updating local pfile
INFO: 2019-02-02 04:46:04: Checking database name
INFO: 2019-02-02 04:46:04: Modifying DB instance
INFO: 2019-02-02 04:46:04: Setup ACFS dependency
SUCCESS: 2019-02-02 04:46:09: Clone database 'GOLDDB' created successfully
INFO: 2019-02-02 04:46:09: Starting database 'GOLDDB'
SUCCESS: 2019-02-02 04:46:10: Successfully created clone database 'GOLDDB'
[root@na2exdbadm03sp ~]#


Start with root user:
[root@na2exdbadm03sp oragold]# srvctl status database -d GOLDDB
Instance GOLDDB is not running on node na2exdbadm03sp
[root@na2exdbadm03sp oragold]# srvctl start database -d GOLDDB
[root@na2exdbadm03sp oragold]# srvctl status database -d GOLDDB
Instance GOLDDB is running on node na2exdbadm03sp
[root@na2exdbadm03sp oragold]#

Once you started with root user again login to oragold user and rerun the servctk start again to register DB with cluster then only scan-name:1521 connection will work

[root@na2exdbadm03sp oragold]# su - oragold
[oragold@na2exdbadm03sp ~]$ . GOLDDB.env 

[oragold@na2exdbadm03sp ~]$ srvctl start database -d GOLDDB
PRCC-1014 : GOLDDB was already running
PRCR-1004 : Resource ora.GOLDDB.db is already running
PRCR-1079 : Failed to start resource ora.GOLDDB.db
CRS-5702: Resource 'ora.GOLDDB.db' is already running on 'na2exdbadm03sp'
[oragold@na2exdbadm03sp ~]$ 

[oragold@na2exdbadm03sp ~]$ srvctl status database -d GOLDDB
Instance GOLDDB is running on node na2exdbadm03sp


Post steps:
execute dbms_stats.gather_schema_stats('SYS', method_opt=>'for all columns size 1', degree=>30,estimate_percent=>100,cascade=>true);
BEGIN
   DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
END;

execute dbms_stats.gather_dictionary_stats ();
execute DBMS_STATS.GATHER_SYSTEM_STATS ('EXADATA');
exec dbms_stats.gather_system_stats ('NOWORKLOAD');


gdb_rpm_instalation:
================
[root@na2exdbadm04sp ~]# cd /opt/
[root@na2exdbadm04sp opt]# rpm -i gDBClone-3.0.2-100.noarch.rpm 
warning: gDBClone-3.0.2-100.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID e7004b4d: NOKEY
gDBClone-3.0.2.100 has been installed on /opt/gDBClone succesfully!

[root@na2exdbadm04sp opt]# rpm -qa|grep gDBClone
gDBClone-3.0.2-100.noarch
[root@na2exdbadm04sp opt]#

ACFS Info:
=========
1)
[root@na2exdbadm04sp ~]# crsctl stat res -t |grep acfs
ora.acfs_dg.acfsvol1.acfs
               ONLINE  ONLINE       na2exdbadm01sp           mounted on /acfsmoun
                                                             ts/acfs1,STABLE
               ONLINE  ONLINE       na2exdbadm02sp           mounted on /acfsmoun
                                                             ts/acfs1,STABLE
               ONLINE  ONLINE       na2exdbadm03sp           mounted on /acfsmoun
                                                             ts/acfs1,STABLE
               ONLINE  ONLINE       na2exdbadm04sp           mounted on /acfsmoun
                                                             ts/acfs1,STABLE
 
2)

[root@na2exdbadm04sp ~]# /sbin/acfsutil info fs /acfsmounts/acfs1/
/acfsmounts/acfs1/
    ACFS Version: 12.2.0.1.0
    on-disk version:       46.0
    compatible.advm:       12.2.0.0.0
    ACFS compatibility:    12.2.0.0.0
    flags:        MountPoint,Available
    mount time:   Mon Jun 10 15:41:49 2019
    mount sequence number: 1
    allocation unit:       4096
    metadata block size:   4096
    volumes:      1
    total size:   139135465553920  ( 126.54 TB )
    total free:   70780555186176  (  64.37 TB )
    file entry table allocation: 655360
    primary volume: /dev/asm/acfsvol1-467
        label:                 
        state:                 Available
        major, minor:          248, 239105
        logical sector size:   512
        size:                  139135465553920  ( 126.54 TB )
        free:                  70780555186176  (  64.37 TB )
        metadata read I/O count:         105945222
        metadata write I/O count:        271
        total metadata bytes read:       433955880960  ( 404.15 GB )
        total metadata bytes written:    8769536  (   8.36 MB )
        ADVM diskgroup:        ACFS_DG
        ADVM resize increment: 536870912
        ADVM redundancy:       mirror
        ADVM stripe columns:   8
        ADVM stripe width:     1048576
    number of snapshots:  4
    snapshot space usage: 68078018469888  (  61.92 TB )
    replication status: DISABLED
    compression status: DISABLED
[root@na2exdbadm04sp ~]# 

3)

[root@na2exdbadm04sp ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VGExaDb-LVDbSys1
                       30G   11G   18G  39% /
tmpfs                 756G  617M  756G   1% /dev/shm
/dev/sda1             488M   33M  420M   8% /boot
/dev/mapper/VGExaDb-LVDbOra1
                       99G   44G   51G  47% /u01
/dev/asm/acfsvol1-467
                      127T   63T   65T  50% /acfsmounts/acfs1
192.195.1.1:/export/Nprod-10g-1/backup1
                       98T   81T   18T  82% /zfs-10G/orabknp1
192.195.1.2:/export/Nprod-10g-2/backup2
                       57T   38T   19T  67% /zfs-10G/orabknp2
192.195.1.1:/export/Prod-IB-1/backup1
                      103T   86T   18T  83% /zfs-IB-10g/orabkp1
192.195.1.2:/export/Prod-IB-2/backup2
                      146T  127T   19T  88% /zfs-IB-10g/orabkp2
[root@na2exdbadm04sp ~]# 


4) Dismount the ACFS:
/bin/umount /acfsmounts/acfs1

[root@na2exdbadm04sp ~]# df -h /acfsmounts/acfs1/
Filesystem            Size  Used Avail Use% Mounted on
/dev/asm/acfsvol1-467
                      127T   63T   65T  50% /acfsmounts/acfs1
[root@na2exdbadm04sp ~]# /bin/umount /acfsmounts/acfs1
[root@na2exdbadm04sp ~]# df -h /acfsmounts/acfs1/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VGExaDb-LVDbSys1
                       30G   11G   18G  39% /
[root@na2exdbadm04sp ~]# 


5) grant permission
[root@na2exdbadm04sp ~]# ls -ld /acfsmounts/acfs1
d--------- 2 root root 4096 Jun 10 14:59 /acfsmounts/acfs1
[root@na2exdbadm04sp ~]# cd /acfsmounts/acfs1/
[root@na2exdbadm04sp acfs1]# ls -ltrh
total 0
[root@na2exdbadm04sp acfs1]# cd 
[root@na2exdbadm04sp ~]# chmod -R 777 /acfsmounts/
[root@na2exdbadm04sp ~]# ls -ld /acfsmounts/acfs1
drwxrwxrwx 2 root root 4096 Jun 10 14:59 /acfsmounts/acfs1
[root@na2exdbadm04sp ~]# 

6) Mount the filesystem:
/bin/mount -t acfs /dev/asm/acfsvol1-467 /acfsmounts/acfs1

[root@na2exdbadm04sp ~]# df -h /acfsmounts/acfs1/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VGExaDb-LVDbSys1
                       30G   11G   18G  39% /
[root@na2exdbadm04sp ~]# /bin/mount -t acfs /dev/asm/acfsvol1-467 /acfsmounts/acfs1
[root@na2exdbadm04sp ~]# df -h /acfsmounts/acfs1/
Filesystem            Size  Used Avail Use% Mounted on
/dev/asm/acfsvol1-467
                      127T   63T   65T  50% /acfsmounts/acfs1
[root@na2exdbadm04sp ~]# 


7) Deleting snaps:
/sbin/acfsutil snap delete GOLDDB /acfsmounts/acfs1

Regards,
Mallik

No comments:

Post a Comment

Query taking more time?  1. DML Query (Insert, Update,) Cause: locks / deadlocks  Fix/Solution: kill / Ask user to do commit/rollback   2. S...