2014년 11월 6일 목요일

[EBS] Cloning Sample for ExaData or ODA machines (ASM and RMAN Env.)

1. User Add
useradd -d /home/oratst -u 1004 -g 1001 -G dba -s /bin/ksh oratst
usermod -a -G asmdba oratst
passwd oratst

2. Central Inventory
vi /etc/oraInst.loc

3. PreClone

4. Copy Files and Change Owner
su -
cd /u01/TST
mkdir -p db/tech_st
mkdir temp
cp -RH /u01/PRD/db/tech_st/11.2.0 db/tech_st
chown -R oratst:oinstall /u01/TST

5. Create .profile

6. Clone - ORACLE_HOME
export PATH=/u01/TST/db/tech_st/11.2.0/perl/bin:$PATH
export PERL5LIB=/u01/TST/db/tech_st/11.2.0/perl/lib/5.10.0:/u01/TST/db/tech_st/11.2.0/perl/lib/site_perl/5.10.0:/u01/TST/db/tech_st/11.2.0/appsutil/perl
cd $ORACLE_HOME/appsutil/clone/bin
perl adcfgclone.pl dbTechStack

7. Set Oracle Binary Permission
su - grid
/u01/app/11.2.0.4/grid/bin/setasmgidwrap o=/u01/TST/db/tech_st/11.2.0/bin/oracle

8. SSH (Skip)

8.1 Delete Database
RMAN> CONNECT TARGET /
RMAN> STARTUP FORCE MOUNT
RMAN> SQL 'ALTER SYSTEM ENABLE RESTRICTED SESSION';
RMAN> DROP DATABASE INCLUDING BACKUPS NOPROMPT;


9. Create password file

10. Add TNS (Source and Target)
PRD = (DESCRIPTION=
                (ADDRESS=(PROTOCOL=tcp)(HOST=erpdb1)(PORT=1531))
                (CONNECT_DATA=(SID=PRD))
            )

TST = (DESCRIPTION=
                (ADDRESS=(PROTOCOL=tcp)(HOST=erpdb1)(PORT=1591))
                (CONNECT_DATA=(SID=TST))
            )

10. Edit init.ora
CONTROL_FILES = ('+DATA/TST/CONTROLFILE/ccntrl01.dbf','+DATA/TST/CONTROLFILE/ccntrl02.dbf','+DATA/TST/CONTROLFILE/ccntrl03.dbf')
DB_FILE_NAME_CONVERT = ('+DATA/PRD','+DATA/TST')
LOG_FILE_NAME_CONVERT = ('+REDO/PRD','+REDO/TST')
COMPATIBLE = 11.2.0.4
LOG_ARCHIVE_DEST_1 = 'LOCATION=+REDO'

11. Duplicate Database
orapwd file=orapwTST password=manager entries=5

SQL> STARTUP FORCE NOMOUNT;

$ rman TARGET sys/manager@prd AUXILIARY sys/manager@tst

RMAN>
RUN
{
  ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
  ALLOCATE CHANNEL c2 DEVICE TYPE DISK;
  ALLOCATE CHANNEL c3 DEVICE TYPE DISK;
  ALLOCATE CHANNEL c4 DEVICE TYPE DISK;
  ALLOCATE AUXILIARY CHANNEL ac1 DEVICE TYPE DISK;
  ALLOCATE AUXILIARY CHANNEL ac2 DEVICE TYPE DISK;
  ALLOCATE AUXILIARY CHANNEL ac3 DEVICE TYPE DISK;
  ALLOCATE AUXILIARY CHANNEL ac4 DEVICE TYPE DISK;
  SET UNTIL TIME "TO_DATE('2014/07/21 16:25:00', 'YYYY/MM/DD HH24:MI:SS')";
  DUPLICATE TARGET DATABASE
    TO TST
    LOGFILE
      GROUP 1 ('+REDO') SIZE 1000M REUSE,
      GROUP 2 ('+REDO') SIZE 1000M REUSE,
      GROUP 3 ('+REDO') SIZE 1000M REUSE
  NOFILENAMECHECK;
}


12. Restore SPFILE
SQL> STARTUP NOMOUNT
SQL> CREATE SPFILE FROM PFILE;
RMAN> STARTUP FORCE MOUNT
RMAN> BACKUP AS BACKUPSET SPFILE TAG='TST_SPFILE';
RMAN> RESTORE SPFILE TO '+DATA/TST/spfileTST.ora';
RMAN> SHUTDOWN IMMEDIATE;

$ vi $ORACLE_HOME/dbs/initTST.ora
SPFILE='+DATA/DEV/spfileTST.ora'

SQL> STARTUP FORCE NOMOUNT
ALTER SYSTEM SET compatible="11.2.0.4" scope=spfile;
ALTER SYSTEM SET "_disable_interface_checking"=true SCOPE=spfile;
ALTER SYSTEM SET "_gc_undo_affinity"=false SCOPE=spfile;
ALTER SYSTEM SET "_gc_policy_time"=0 SCOPE=spfile;
ALTER SYSTEM SET "_enable_numa_support"=false SCOPE=spfile;
ALTER SYSTEM SET "_file_size_increase_increment"=2G SCOPE=spfile;
ALTER SYSTEM SET db_recovery_file_dest='+RECO' SCOPE=spfile;
ALTER SYSTEM SET db_recovery_file_dest_size=100G SCOPE=spfile;
ALTER SYSTEM SET db_create_file_dest='+DATA' SCOPE=spfile;
ALTER SYSTEM SET db_create_online_log_dest_1='+REDO' SCOPE=spfile;
ALTER SYSTEM SET db_block_checksum=full SCOPE=spfile;
ALTER SYSTEM SET db_block_checking=full SCOPE=spfile;
ALTER SYSTEM SET db_lost_write_protect=typical SCOPE=spfile;
ALTER SYSTEM SET filesystemio_options=setall SCOPE=spfile;
ALTER SYSTEM SET log_archive_dest_1='LOCATION=+RECO' SCOPE=spfile;

SQL> ALTER DATABASE MOUNT;
SQL> ALTER DATABASE OPEN;

댓글 없음:

댓글 쓰기