This blog aim to share knowledge to all readers about Database Administrator tasks. The knowledge shared are from my experience, real testing. Not only database administrator tasks will be shared, but also other knowledge related DBA will be published.
Thursday, January 3, 2013
Restore RAC Database to different ASM
cd $ORACLE_HOME/dbs
vi TESTDB.ora
------------
*.audit_file_dest='/u01/app/oracle/admin/TESTDB/adump'
*.audit_trail='db'
*.compatible='11.2.0.3.0'
*.control_files='+DATA_DM01/TESTDB/control.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='TESTDB'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=TESTDBXDB)'
*.log_archive_dest_1='LOCATION=+RECO_DM01'
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=2G
*.processes=1500
*.remote_login_passwordfile='exclusive'
*.sessions=1655
*.sga_target=10G
*.undo_tablespace='UNDOTBS1'
*.DB_FILE_NAME_CONVERT='+DATA_DM02','+DATA_DM01'
*.LOG_FILE_NAME_CONVERT='+RECO_DM02','+RECO_DM01'
*.db_create_file_dest=+DATA_DM01
*.db_create_online_log_dest_1=+RECO_DM01
===============================================
mkdir -p /u01/app/oracle/admin/TESTDB/adump
export ORACLE_SID=TESTDB
SQL>startup nomount pfile='TESTDB.ora';
RMAN> restore controlfile from '/data141/TESTDB_DR_PRECON/c-1354439492-20121226-00';
RMAN>alter database mount;
RMAN>catalog start with '/data141/TESTDB_DR_PRECON/';
RMAN>
run {
restore database;
recover database;
}
RMAN> alter database open resetlogs;
SQL>shut immediate;
vi TESTDB.ora
====================================================pfile
*.audit_file_dest='/u01/app/oracle/admin/TESTDB/adump'
*.audit_trail='NONE'
*.cluster_database=false
*.compatible='11.2.0.3.0'
*.control_files='+DATA_DM01/TESTDB/control.ctl'
*.db_block_size=8192
*.db_create_file_dest='+DATA_DM01'
*.db_create_online_log_dest_1='+RECO_DM01'
*.db_domain=''
*.db_name='TESTDB'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=TESTDBXDB)'
TESTDB3.instance_number=3
TESTDB2.instance_number=2
TESTDB1.instance_number=1
TESTDB4.instance_number=4
*.log_archive_dest_1='LOCATION=+RECO_DM01'
*.log_archive_format='%t_%s_%r.arc'
*.pga_aggregate_target=2G
*.processes=1500
*.remote_listener='dm01-scan:1521'
*.remote_login_passwordfile='exclusive'
*.sessions=1655
*.sga_max_size=10G
*.sga_target=10G
*.shared_pool_size=2G
*.shared_servers=0
TESTDB3.thread=3
TESTDB4.thread=4
TESTDB2.thread=2
TESTDB1.thread=1
TESTDB1.undo_tablespace='UNDOTBS1'
TESTDB2.undo_tablespace='UNDOTBS2'
TESTDB3.undo_tablespace='UNDOTBS3'
TESTDB4.undo_tablespace='UNDOTBS4'
==================
SQL>startup nomount pfile='TESTDB.ora';
SQL>create spfile='+DATA_DM01/TESTDB/spfileTESTDB.ora' from pfile='TESTDB.ora';
SQL>shut immediate;
vi TESTDB.ora
spfile='+DATA_DM01/TESTDB/spfileTESTDB.ora'
SQL>startup nomount pfile='TESTDB.ora';
SQL>alter database mount;
SQL>alter database open;
SQL>alter system set cluster_database=true scope=spfile sid='*';
alter system set cluster_database_instances=4 scope=spfile sid='*';
SQL>shut immediate;
Add 4 nodes:
vi $ORACLE_HOME/network/admin/tnsnames.ora
TESTDB=
(DESCRIPTION =
(SDU=32767)
(TDU=32767)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dm01-scan)(PORT = 1521))
(SEND_BUF_SIZE=32767)
(RECV_BUF_SIZE=32767)
(TCP.NODELAY = YES)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME=TESTDB)
)
)
4 nodes:
mkdir -p /u01/app/oracle/admin/TESTDB/adump
orapwd file=/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/orapwTESTDB1 password=oracle FORCE=Y
orapwd file=/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/orapwTESTDB2 password=oracle FORCE=Y
orapwd file=/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/orapwTESTDB3 password=oracle FORCE=Y
orapwd file=/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/orapwTESTDB4 password=oracle FORCE=Y
Create 4 init: initTESTDB1,initTESTDB2,initTESTDB3,initTESTDB4
echo spfile=\'+DATA_DM01/TESTDB/spfileTESTDB.ora\' > /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/initTESTDB1.ora
echo spfile=\'+DATA_DM01/TESTDB/spfileTESTDB.ora\' > /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/initTESTDB2.ora
echo spfile=\'+DATA_DM01/TESTDB/spfileTESTDB.ora\' > /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/initTESTDB3.ora
echo spfile=\'+DATA_DM01/TESTDB/spfileTESTDB.ora\' > /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/initTESTDB4.ora
$ srvctl add database -d TESTDB -o /u01/app/oracle/product/11.2.0.3/dbhome_1
srvctl add instance -d TESTDB -i TESTDB1 -n dm01db01
srvctl add instance -d TESTDB -i TESTDB2 -n dm01db02
srvctl add instance -d TESTDB -i TESTDB3 -n dm01db03
srvctl add instance -d TESTDB -i TESTDB4 -n dm01db04
srvctl start database -d TESTDB
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment