To test the creation of a data guard environment on the same server.
The main library is in a normal state and there are available backups, and the force logging and associated initialization parameters for the main library are set below:
sql> ALTER DATABASE force logging;
Database altered.
To modify the initialization parameters of the main library:
Sql> alter system set Log_archive_config = ' dg_config= (primary,standby) ';
System altered.
Sql> alter system set log_archive_dest_1 = ' Location=/data/oradata/primary/archivelog valid_for= (ALL_LOGFILES,ALL_ ROLES) Db_unique_name=primary ';
System altered.
Sql> alter system set log_archive_dest_2 = ' Service=standby lgwr SYNC valid_for= (online_logfiles,primary_role) DB_ Unique_name=standby ';
System altered.
Sql> alter system set fal_server = Standby;
System altered.
Sql> alter system set fal_client = primary;
System altered.
Sql> alter system set standby_file_management = auto;
System altered.
Establish Standby_logfile in the main library:
Sql> Select group#, thread#, sequence#, bytes/1024/1024 from V$log;
group# thread# sequence# bytes/1024/1024
---------- ---------- ---------- ---------------
1 1 4 500
2 1 5 500
3 1 3 500
Sql> Select member from V$logfile;
Member
------------------------------------------------------------------------------------
/data/oradata/primary/redo01.log
/data/oradata/primary/redo02.log
/data/oradata/primary/redo03.log
sql> ALTER DATABASE Add standby logfile '/data/oradata/primary/standby_redo01.log ' size500m;
Database altered.
sql> ALTER DATABASE Add standby logfile '/data/oradata/primary/standby_redo02.log ' size500m;
Database altered.
sql> ALTER DATABASE Add standby logfile '/data/oradata/primary/standby_redo03.log ' size500m;
Database altered.
sql> ALTER DATABASE Add standby logfile '/data/oradata/primary/standby_redo04.log ' size500m;
Database altered.
For standby logfile should be more than redo logfile a group.
The following creates the directory structure required by the standby database:
Sql> host Mkdir-p/data/oradata/standby/archivelog
Sql> host Mkdir-p/opt/ora10g/admin/standby/bdump
Sql> Host Mkdir/opt/ora10g/admin/standby/cdump
Sql> Host Mkdir/opt/ora10g/admin/standby/adump
Sql> Host Mkdir/opt/ora10g/admin/standby/udump
To create the initialization files required by the standby database:
sql> create pfile= '/home/oracle/initstandby.ora ' from SPFile;
File created.
Edit the initialization file, modify the associated path, and set initialization parameters for the corresponding standby database:
[Oracle@yans1 ~]$ VI Initstandby.ora
primary.__db_cache_size=1644167168
primary.__java_pool_size=16777216
primary.__large_pool_size=16777216
primary.__shared_pool_size=452984832
Primary.__streams_pool_size=0
*.audit_file_dest= '/opt/ora10g/admin/standby/adump '
*.audit_trail= ' NONE '
*.background_dump_dest= '/opt/ora10g/admin/standby/bdump '