Before you can create a logical repository, you must first create a physical repository, and for how to create a physical library, refer to the Data Guard series (4)-Creating a physical repository without stopping the main library.
1. Stop the Log Application service on the physical repository
sys@jkka> ALTER database RECOVER MANAGED STANDBY database CANCEL;
Database altered.
2. Reset the main library to prepare for future role conversion (switchover)
The logical repository is not the same as the physical repository, in the SQL application will also produce a log, that is, the logic of the online redo log, so the logical repository not only to the main library from the standby log to archive, but also have to prepare the library of their own generated online log archive. Here we assume that log_archive_dest_1 specifies the archive path for the standby log, log_archive_dest_3 specifies the archive path for the online log.
Although the main library does not require two archive paths to be configured, it is generally recommended that you do so in the main library in order to facilitate possible role transitions (switchover) in the future.
First, look at the log_archive_dest_1 of the current main library:
Sys@jkka> Show parameter log_archive_dest_1
NAME TYPE VALUE
---------------------------------- -------------------------------------------
log_archive_dest_1 string location=/data/oradata/jkka/ Archivelog
valid_for= (all_logfiles,all_roles)
Db_unique_name=jkka
The Valid_for attribute needs to be modified to only take effect on the online log:
Sys@jkka> alter system set log_archive_dest_1= ' Location=/data/oradata/jkka/archivelog
valid_for= (online_ logfiles,all_roles) Db_unique_name=jkka ';
System altered.
The new standby archive directory is then created on the OS, and the new log_archive_dest_3 points to it:
Sys@jkka> alter system set log_archive_dest_3= ' Location=/data/oradata/jkka/archstandby
valid_for= (STANDBY_ logfiles,standby_role) Db_unique_name=jkka ';
System altered.
Sys@jkka> alter system set log_archive_dest_state_3=enable;
System altered.
3. Building the Logminer dictionary in the main library
Sys@jkka> EXECUTE Dbms_logstdby. Build;
Pl/sql procedure successfully completed.
4. Convert physical standby to logical repository
Sys@jkka> ALTER DATABASE RECOVER to LOGICAL STANDBY jkka2;
Database altered.
Note: The JKKA2 above is the db_name of the new logical repository, which must be different from the db_name of the main library, which is not the same as the physical repository.
After successful execution of the above statement, the db_name of the repository is modified to the new name JKKA2, the standby is closed, and the Mount status is restarted to take effect:
sql> shutdown Immediate
Sql> Startup Mount