1. copy password file
if it's 12c database.
run as grid : asmcmd>pwcopy --dbuniquename dbname +datadg/dbname/PASSWORD/pwddbname.277.905359761 /networkbackuplocation/pwddbname.277.905359761
the copy is successful although the output has a message ASMCMD-9456: password file should be located on an ASM disk group"
run as root : asmcmd>pwcopy --dbuniquename dbname_rac /networkbackuplocation/pwddbname.277.905359761 +datadg/orapwdbname_rac
ASMCMD [+] > ls -l +datadg/orapwdbname_rac
Type Redund Striped Time Sys Name
PASSWORD UNPROT COARSE FEB 02 11:00:00 N orapwdbname_rac => +datadg/ASM/PASSWORD/pwdasm.284.934889179
or
run as grid : ASMCMD [+datadg] > pwcopy /networkbackuplocation/pwddbname.277.905359761 +datadg/dbname_rac/PASSWORD/pwdbname_rac
copying /networkbackuplocation/pwddbname.277.905359761 -> +datadg/dbname_rac/PASSWORD/pwdbname_rac
ASMCMD [+datadg/ASM/password] > ls -l +datadg/dbname_rac/PASSWORD/pwdbname_rac
Type Redund Striped Time Sys Name
PASSWORD UNPROT COARSE FEB 02 14:00:00 N pwdbname_rac => +datadg/ASM/PASSWORD/pwdasm.284.934898903
run as oracle : srvctl modify database -d dbname_rac -pwfile +datadg/dbname_rac/PASSWORD/pwdbname_rac
ASMCMD [+] > ls -l +datadg/orapwdbname_rac
Type Redund Striped Time Sys Name
PASSWORD UNPROT COARSE FEB 02 11:00:00 N orapwdbname_rac => +datadg/ASM/PASSWORD/pwdasm.284.934889179
if it's 11g database:
scp $ORACLE_HOME/dbs/orapwdbname1 @vdclracdev01:$ORACLE_HOME/dbs/orapwdbname_1
2. prepare source database.
alter database force logging;
alter system set log_archive_dest_2 = 'SERVICE=dbname_rac VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dbname_rac' scope=both;
alter system set log_archive_config = 'dg_config=(dbname_rac,dbname)' scope=both;
create pfile='/networkbackuplocation/init.ora' from spfile;
ALTER SYSTEM SET fal_server='dbname_rac' SCOPE=BOTH; -- on primary db side
3. backup source database
run {
allocate channel d1 type disk format '/networkbackuplocation/%U';
allocate channel d2 type disk format '/networkbackuplocation/%U';
allocate channel d3 type disk format '/networkbackuplocation/%U';
allocate channel d4 type disk format '/networkbackuplocation/%U';
backup database plus archivelog ;
}
backup current controlfile format '/networkbackuplocation/controlfile'
4. dbca create standby database
4b create tnsnames.ora entry on both side so they can connect to each other
dbname.OPS.company.com =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vdclractst04.bcferries.corp)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = dbname.OPS.company.com)
)
)
dbname_rac.company.com =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan.stg01.rac.bcferries.corp)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbname_rac)
)
)
5. prepare standby database
add this line: *.db_unique_name='dbname_rac' to /networkbackuplocation/init.ora
shutdown abort; or srvctl srvctl stop database -d dbname_rac
startup nomount pfile='/networkbackuplocation/init.ora';
create spfile='+datadg/dbname_rac/spfiledbname_rac.ora' from pfile='/networkbackuplocation/init.ora';
asmcmd ls -l +datadg/dbname_rac/spfiledbname_rac.ora
shutdown abort;
startup nomount;
show parameter spfile;
ALTER SYSTEM SET fal_server='dbname.ops.company.com' SCOPE=BOTH; --- on standby db side
alter system set service_names='dbname_rac.company.com,dbname,dbname.company.com' scope=both;
alter system set log_archive_dest_2 = 'SERVICE=dbname.OPS.company.com VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dbname' scope=both;
6. clean up origional datafiles
asmcmd rm +datadg/dbname_rac/datafile/*
asmcmd rm +datadg/dbname_rac/tempfile/*
asmcmd rm +datadg/dbname_rac/online*/*
asmcmd rm +datadg/dbname_rac/control*/*
asmcmd rm +fradg/dbname_rac/control*/*
asmcmd rm +fradg/dbname_rac/online*/*
7. duplicate standby database in rman
rman target=sys/password@dbname.ops.company.com auxiliary /
run {
allocate auxiliary channel d1 type disk;
allocate auxiliary channel d2 type disk;
allocate auxiliary channel d3 type disk;
allocate auxiliary channel d4 type disk;
duplicate target database for standby;
}
8. recover standby database
alter database open; -- one instance only
--recover managed standby database using current logfile disconnect;
--or
recover managed standby database disconnect;
-- alter system archive log current; -- run on primary db side
set linesize 200
select * from v$dataguard_stats;
SELECT inst_id,PROCESS, pid,client_pid,client_process,STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM gV$MANAGED_STANDBY
where (process='RFS' and thread#<>0) or process<>'RFS'
order by process, inst_id,thread#;
create table dropit (col1 int);
alter system archive log current;
select * from dropit;
9. switchover:
on origional primary side:
SELECT SWITCHOVER_STATUS FROM V$DATABASE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
SHUTDOWN ABORT;
startup;
recover managed standby database disconnect;
on origional standby side:
SELECT SWITCHOVER_STATUS FROM V$DATABASE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;
ALTER DATABASE OPEN;
create table dropit2 (col1 int);
alter system archive log current;
on new standby side:
select * from dropit2;
set linesize 200
select * from v$dataguard_stats;
10. enable RAC on new primary database:
ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 4 ('+datadg','+fradg') size 500M,
GROUP 5 ('+datadg','+fradg') size 500M,
GROUP 6 ('+datadg','+fradg') size 500M
ALTER DATABASE ADD LOGFILE THREAD 3
GROUP 7 ('+datadg','+fradg') size 500M,
GROUP 8 ('+datadg','+fradg') size 500M,
GROUP 9 ('+datadg','+fradg') size 500M
select thread#,group#,bytes ,status from v$log;
ALTER DATABASE ENABLE PUBLIC THREAD 2;
ALTER DATABASE ENABLE PUBLIC THREAD 3;
srvctl start database -d dbname_rac
10 decouple dataguard:
alter system set log_archive_config='NODG_CONFIG' scope=both;
shutdown and delete dataguard database.
if it's 12c database.
run as grid : asmcmd>pwcopy --dbuniquename dbname +datadg/dbname/PASSWORD/pwddbname.277.905359761 /networkbackuplocation/pwddbname.277.905359761
the copy is successful although the output has a message ASMCMD-9456: password file should be located on an ASM disk group"
run as root : asmcmd>pwcopy --dbuniquename dbname_rac /networkbackuplocation/pwddbname.277.905359761 +datadg/orapwdbname_rac
ASMCMD [+] > ls -l +datadg/orapwdbname_rac
Type Redund Striped Time Sys Name
PASSWORD UNPROT COARSE FEB 02 11:00:00 N orapwdbname_rac => +datadg/ASM/PASSWORD/pwdasm.284.934889179
or
run as grid : ASMCMD [+datadg] > pwcopy /networkbackuplocation/pwddbname.277.905359761 +datadg/dbname_rac/PASSWORD/pwdbname_rac
copying /networkbackuplocation/pwddbname.277.905359761 -> +datadg/dbname_rac/PASSWORD/pwdbname_rac
ASMCMD [+datadg/ASM/password] > ls -l +datadg/dbname_rac/PASSWORD/pwdbname_rac
Type Redund Striped Time Sys Name
PASSWORD UNPROT COARSE FEB 02 14:00:00 N pwdbname_rac => +datadg/ASM/PASSWORD/pwdasm.284.934898903
run as oracle : srvctl modify database -d dbname_rac -pwfile +datadg/dbname_rac/PASSWORD/pwdbname_rac
ASMCMD [+] > ls -l +datadg/orapwdbname_rac
Type Redund Striped Time Sys Name
PASSWORD UNPROT COARSE FEB 02 11:00:00 N orapwdbname_rac => +datadg/ASM/PASSWORD/pwdasm.284.934889179
if it's 11g database:
scp $ORACLE_HOME/dbs/orapwdbname1 @vdclracdev01:$ORACLE_HOME/dbs/orapwdbname_1
2. prepare source database.
alter database force logging;
alter system set log_archive_dest_2 = 'SERVICE=dbname_rac VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dbname_rac' scope=both;
alter system set log_archive_config = 'dg_config=(dbname_rac,dbname)' scope=both;
create pfile='/networkbackuplocation/init.ora' from spfile;
ALTER SYSTEM SET fal_server='dbname_rac' SCOPE=BOTH; -- on primary db side
3. backup source database
run {
allocate channel d1 type disk format '/networkbackuplocation/%U';
allocate channel d2 type disk format '/networkbackuplocation/%U';
allocate channel d3 type disk format '/networkbackuplocation/%U';
allocate channel d4 type disk format '/networkbackuplocation/%U';
backup database plus archivelog ;
}
backup current controlfile format '/networkbackuplocation/controlfile'
4. dbca create standby database
4b create tnsnames.ora entry on both side so they can connect to each other
dbname.OPS.company.com =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vdclractst04.bcferries.corp)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = dbname.OPS.company.com)
)
)
dbname_rac.company.com =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan.stg01.rac.bcferries.corp)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbname_rac)
)
)
5. prepare standby database
add this line: *.db_unique_name='dbname_rac' to /networkbackuplocation/init.ora
shutdown abort; or srvctl srvctl stop database -d dbname_rac
startup nomount pfile='/networkbackuplocation/init.ora';
create spfile='+datadg/dbname_rac/spfiledbname_rac.ora' from pfile='/networkbackuplocation/init.ora';
asmcmd ls -l +datadg/dbname_rac/spfiledbname_rac.ora
shutdown abort;
startup nomount;
show parameter spfile;
ALTER SYSTEM SET fal_server='dbname.ops.company.com' SCOPE=BOTH; --- on standby db side
alter system set service_names='dbname_rac.company.com,dbname,dbname.company.com' scope=both;
alter system set log_archive_dest_2 = 'SERVICE=dbname.OPS.company.com VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dbname' scope=both;
6. clean up origional datafiles
asmcmd rm +datadg/dbname_rac/datafile/*
asmcmd rm +datadg/dbname_rac/tempfile/*
asmcmd rm +datadg/dbname_rac/online*/*
asmcmd rm +datadg/dbname_rac/control*/*
asmcmd rm +fradg/dbname_rac/control*/*
asmcmd rm +fradg/dbname_rac/online*/*
7. duplicate standby database in rman
rman target=sys/password@dbname.ops.company.com auxiliary /
run {
allocate auxiliary channel d1 type disk;
allocate auxiliary channel d2 type disk;
allocate auxiliary channel d3 type disk;
allocate auxiliary channel d4 type disk;
duplicate target database for standby;
}
8. recover standby database
alter database open; -- one instance only
--recover managed standby database using current logfile disconnect;
--or
recover managed standby database disconnect;
-- alter system archive log current; -- run on primary db side
set linesize 200
select * from v$dataguard_stats;
SELECT inst_id,PROCESS, pid,client_pid,client_process,STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM gV$MANAGED_STANDBY
where (process='RFS' and thread#<>0) or process<>'RFS'
order by process, inst_id,thread#;
create table dropit (col1 int);
alter system archive log current;
select * from dropit;
9. switchover:
on origional primary side:
SELECT SWITCHOVER_STATUS FROM V$DATABASE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
SHUTDOWN ABORT;
startup;
recover managed standby database disconnect;
on origional standby side:
SELECT SWITCHOVER_STATUS FROM V$DATABASE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;
ALTER DATABASE OPEN;
create table dropit2 (col1 int);
alter system archive log current;
on new standby side:
select * from dropit2;
set linesize 200
select * from v$dataguard_stats;
10. enable RAC on new primary database:
ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 4 ('+datadg','+fradg') size 500M,
GROUP 5 ('+datadg','+fradg') size 500M,
GROUP 6 ('+datadg','+fradg') size 500M
ALTER DATABASE ADD LOGFILE THREAD 3
GROUP 7 ('+datadg','+fradg') size 500M,
GROUP 8 ('+datadg','+fradg') size 500M,
GROUP 9 ('+datadg','+fradg') size 500M
select thread#,group#,bytes ,status from v$log;
ALTER DATABASE ENABLE PUBLIC THREAD 2;
ALTER DATABASE ENABLE PUBLIC THREAD 3;
srvctl start database -d dbname_rac
10 decouple dataguard:
alter system set log_archive_config='NODG_CONFIG' scope=both;
shutdown and delete dataguard database.
Comments
Post a Comment