New to DB. Interested in Oracle Data Guard. New working with RMAN.
All of this is for testing only and does not involve any kind of production env.
Making use of ORACLE documentation:
- Step by Step Guide on Creating Physical Standby Using RMAN DUPLICATE...FROM ACTIVE DATABASE (Doc ID 1075908.1)
. .==========================================================================. .
The Primary Database:
[oracle@ol12c pridb]$ env | grep ORA
ORACLE_UNQNAME=cdb1
ORACLE_SID=pridb
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ol12c.localdomain
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
SQL> startup pfile=/u01/app/oracle/product/12.1.0.2/db_1/dbs/initpridb.ora;
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/oracle/fast_recovery_
area
db_recovery_file_dest_size big integer 2G
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 12
Next log sequence to archive 13
Current log sequence 13
. .==========================================================================. .
2. The Standby:
[oracle@ol12c stbdb]$ env | grep ORA
ORACLE_UNQNAME=cdb1
ORACLE_SID=stbdb
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ol12c.localdomain
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
SQL> startup nomount pfile='/u01/app/oracle/product/12.1.0.2/db_1/dbs/initstbdb.ora'
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/oracle/fast_recovery_
area/stbdb
db_recovery_file_dest_size big integer 2G
. .==========================================================================. .
3. RMAN (On the primary db):
[oracle@ol12c pridb]$ rman
RMAN> connect target sys/oracle@pridb
connected to target database: PRIDB (DBID=1212094364)
RMAN> connect auxiliary sys/oracle@stbdb
connected to auxiliary database: PRIDB (not mounted)
. .==========================================================================. .
4. Error:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "db_unique_name": expecting one of: "archivelog, autobackup, auxiliary, auxname, backup, catalog, command, compression, controlfile, database, dbid, decryption, default, echo, encryption, high, incarnation, incremental, long, maxcorrupt, maxseq, newname, nocfau, numwidth, restore, snapshot, to restore point, until restore point, until, "
RMAN-01007: at line 1 column 1 file: standard input
AND
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "archivelog, autobackup, auxiliary, auxname, backup, catalog, command, compression, controlfile, database, dbid, decryption, default, echo, encryption, high, incarnation, incremental, long, maxcorrupt, maxseq, newname, nocfau, numwidth, restore, snapshot, to restore point, until restore point, until, "
RMAN-01008: the bad identifier was: log_archive_dest_2
RMAN-01007: at line 1 column 7 file: standard input
I receive the RMAN-01008 error for all the parameters specified in the command starting from log_file_name_convert.
. .==========================================================================. .
5. My input:
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate auxiliary channel aux type disk;
duplicate target database for standby from active database
parameter_value_convert'pridb','stbdb'
set db_unique_name='stbdb'
set db_file_name_convert='pridb','stbdb'
set log_file_name_convert='pridb','stbdb'
set control_files='/u01/app/oracle/oradata/stbdb/stbdb_control1.ctl'
set standby_file_management='AUTO'
set log_archive_max_processes='10'
set fal_client='stbdb'
set fal_server='pridb'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(pridb,stbdb)'
set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=stbdb'
set log_archive_dest_2='service=testdb ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=stbdb'
;
}
First I got:
RMAN-05557: Target instance not started with server parameter file
Because I was trying: duplicate target database for standby from active database spfile
and I am not starting from an spfile but directly from the pfile.
As per my research, I should be able to not specify the SPfile:
Thus I changed from duplicate target database for standby from active database spfile
to duplicate target database for standby from active database
which should work as mentioned in the links I checked.
--> But which parameters am I updating now? To me, this doesn't seem logical. .
The above code ran once with success on allocating the channels but then stopped and started throwing errors.
Currently I am running the script in rman checksyntax
just to be sure I don't break anything.. :)
. .==========================================================================. .
Can you please help me with:
Me trying to understand RMAN better.
Figuring out what I am doing wrong in the above situation. (+ Why!)
I have more interest in understanding what is going on etc than making this work quickly.
(Even though it working would be great ofcouse! :) The purpose at this point is learning)
Thank you in advance for your help!
. .==========================================================================. .
SOLUTION
A SPFILE IS REQUIRED
On the primary database:
SQL> create spfile from pfile='/u01/app/oracle/product/12.1.0.2/db_1/dbs/initpridb.ora';
File created.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 2932632 bytes
Variable Size 671088744 bytes
Database Buffers 394264576 bytes
Redo Buffers 5455872 bytes
Database mounted.
Database opened.
Then started RMAN and ran the script is running as we speak! :) - YEY!
Following error:
RMAN-05537: DUPLICATE without TARGET connection when auxiliary instance is started with spfile cannot use SPFILE clause
Solved by updating the script values & re-connecting the dbs.
Final script used:
RMAN> run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate auxiliary channel aux type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert'pridb','stbdb'
set db_unique_name='stbdb'
set db_file_name_convert='/u01/app/oracle/oradata/pridb/PRIDB/datafile/','/u01/app/oracle/oradata/stbdb/STBDB/datafile/'
set log_file_name_convert='/u01/app/oracle/oradata/pridb/PRIDB/onlinelog/','/u01/app/oracle/oradata/stbdb/STBDB/onlinelog/'
set control_files='/u01/app/oracle/oradata/stbdb/stbdb_control1.ctl'
set standby_file_management='AUTO'
set log_archive_max_processes='10'
set fal_client='stbdb'
set fal_server='pridb'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(pridb,stbdb)'
set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=stbdb'
set log_archive_dest_2='service=testdb ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=stbdb'
;
}