In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you about how the Oracle DG is built. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Oracle DG build (cold backup mode)
(1) main library: enable archiving mode
SQL > shutdown immediate
SQL > startup mount
SQL > alter database archivelog
SQL > alter database open
SQL > alter system set db_recovery_file_dest_size=10G
SQL > alter system set db_recovery_file_dest='/home/oracle/flash'
(2) main database: enable the mandatory log writing feature
SQL > select force_logging from v$database
SQL > alter database force logging
(3) main library: turn off flashback
SQL > select flashback_on from v$database
SQL > alter database flashback off
(4) main library: configure static monitoring, configure tnsnames file
[oracle@chen ~] $cd $ORACLE_HOME/network/admin
[oracle@chen admin] $vi listener.ora
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=chicago.us.oracle.com)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME=chicago)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = chen.example.com) (PORT = 1521))
)
)
[oracle@chen admin] $vi tnsnames.ora
Chicago =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = chen.example.com) (PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = chicago.us.oracle.com)
)
)
Boston =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = jch.example.com) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = boston.us.oracle.com)
)
) [oracle@chen admin] $lsnrctl stop
[oracle@chen admin] $lsnrctl start
(5) main library: add standby logfile files
SQL > select member from v$logfile
SQL > select bytes/1024/1024 from v$log
SQL > alter database add standby logfile group 4'/ u01 size size 50m
SQL > alter database add standby logfile group 5'/ u01 size size 50m
SQL > alter database add standby logfile group 6'/ u01 size size 50m
SQL > alter database add standby logfile group 7'/ u01 size size 50m
(6) main library: modify parameter file
Https://docs.oracle.com/cd/E11882_01/server.112/e41134/create_ps.htm#SBYDB00426
Example 3-1 Primary Database: Primary Role Initialization Parameters
Example 3-2 Primary Database: Standby Role Initialization Parameters
SQL > create pfile from spfile
[oracle@chen admin] $cd $ORACLE_HOME/dbs
[oracle@chen dbs] $vi initchicago.ora
* .DB_NAME=chicago
* .DB_UNIQUE_NAME=chicago
* .LOG_ARCHIVE_CONFIG='DG_CONFIG= (chicago,boston)'
* .LOG_ARCHIVE_DEST_1='LOCATION=/home/oracle/flash VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=chicago'
* .LOG_ARCHIVE_DEST_2='SERVICE=boston ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=boston'
* .LOG_ARCHIVE_DEST_STATE_1=ENABLE
* .LOG_ARCHIVE_DEST_STATE_2=ENABLE
* .REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
* .LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
* .FAL_SERVER=boston
* .DB_FILE_NAME_CONVERT='boston','chicago'
* .LOG_FILE_NAME_CONVERT='boston,'chicago'
* .STANDBY_FILE_MANAGEMENT=AUTO
[oracle@chen dbs] $cp spfilechicago.ora spfileboston.ora.bak
SQL > shutdown immediate
SQL > create spfile from pfile
SQL > startup
SQL > show parameter log_archive_dest_2
(7) main warehouse: cold standby for parking
SQL > shutdown immediatre
[oracle@chen admin] $cd / u01/app/oracle/oradata/chicago
[oracle@chen PROD1] $tar-zcvf / home/oracle/dg/chicago.tar.gz *
(8) main library: generate standby controlfile
SQL > startup mount
SQL > alter database create standby controlfile as'/ home/oracle/dg/standby_control01.ctl'
(9) Master library: copy the master library file to the standby database
Cold backup files, listening files, TNS files, parameter files, password files
[oracle@chen dbs] $cp initchicago.ora / home/oracle/dg/
[oracle@chen dbs] $cp orapwchicago / home/oracle/dg/
[oracle@chen admin] $cp listener.ora / home/oracle/dg/
[oracle@chen admin] $cp tnsnames.ora / home/oracle/dg/
[oracle@chen PROD1] $cp chicago.tar.gz / home/oracle/dg
[oracle@chen ~] $tar-zcvf dg.tar.gz dg/
[oracle@chen ~] $scp dg.tar.gz jch:/home/oracle
(10) slave library: configure static monitoring, configure tnsnames.ora file
[oracle@jch ~] $tar-zxvf dg.tar.gz
[oracle@jch ~] $cd $ORACLE_HOME/network/admin
[oracle@jch admin] $mv listener.ora listener.ora.bak
[oracle@jch admin] $mv tnsnames.ora tnsnames.ora.bak
[oracle@jch admin] $cp / home/oracle/dg/listener.ora.
[oracle@jch admin] $cp / home/oracle/dg/tnsnames.ora.
[oracle@jch admin] $vi listener.ora
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=boston.us.oracle.com)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME=boston)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = jch.example.com) (PORT = 1521))
)
)
[oracle@edbjr2p2 admin] $lsnrctl start
(11) Reserve library: modify parameter files and password files
[oracle@jch dbs] $cp / home/oracle/dg/initchicago.ora.
[oracle@jch dbs] $cp / home/oracle/dg/orapwchicago.
[oracle@jch dbs] $mv orapwchicago orapwboston
[oracle@jch dbs] $mv initchicago.ora initboston.ora
[oracle@jch dbs] $vi initboston.ora
:% s/chicago/AAAA/g
:% s/boston/chicago/g
:% s/AAAA/boston/g
* .DB_NAME=chicago
* .DB_UNIQUE_NAME=boston
* .LOG_ARCHIVE_CONFIG='DG_CONFIG= (boston,chicago)'
* .LOG_ARCHIVE_DEST_1='LOCATION=/home/oracle/flash VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=boston'
* .LOG_ARCHIVE_DEST_2='SERVICE=chicago ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=chicago'
* .LOG_ARCHIVE_DEST_STATE_1=ENABLE
* .LOG_ARCHIVE_DEST_STATE_2=ENABLE
* .REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
* .LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
* .FAL_SERVER=chicago
* .DB_FILE_NAME_CONVERT='chicago','boston'
* .LOG_FILE_NAME_CONVERT='chicago','boston'
* .STANDBY_FILE_MANAGEMENT=AUTO
(12) standby library: create the corresponding directory according to the parameter file
[oracle@jch ~] $mkdir flash
[oracle@jch ~] $cd / u01/app/oracle/admin/
[oracle@jch admin] $mkdir boston/adump-p
[oracle@jch ~] $mkdir / u01/app/oracle/oradata/boston
(13) Reserve library: decompress backup files
[oracle@jch dg] $cd / u01/app/oracle/oradata/boston/
[oracle@jch dg] $tar-zxvf chicago.tar.gz
(14) Reserve database: start it.
SQL > startup nomount
[oracle@jch dg] $export ORACLE_SID=boston
[oracle@jch dg] $rman target /
Rman > restore controlfile from'/ home/oracle/control_standby.ctl'
SQL > alter database mount
SQL > alter database open
SQL > recover managed standby database using current logfile disconnect from session
(15) verify whether the construction is successful.
Main library:
SQL > archive log list
SQL > alter system switch logfile
Prepare the library:
SQL > archive log list
SQL > select process, pid, status, client_process from v$managed_standby
SQL > SELECT PROTECTION_MODE, PROTECTION_LEVEL,DATABASE_ROLE ROLE,SWITCHOVER_STATUS FROM V$DATABASE
Standby library: sync data
SQL > alter database open
SQL > recover managed standby database using current logfile disconnect from session
-SQL > recover managed standby database cancel
Main library:
SQL > create table test1 as select level as id from dual connect by level select * from test1
(16) Master-Slave switching
Https://docs.oracle.com/cd/E11882_01/server.112/e41134/role_management.htm#SBYDB00625
Main library:
SQL > SELECT SWITCHOVER_STATUS FROM V$DATABASE
SQL > ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN
SQL > SHUTDOWN ABORT
SQL > STARTUP MOUNT
Prepare the library:
SQL > SELECT SWITCHOVER_STATUS FROM V$DATABASE
SQL > ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN
SQL > ALTER DATABASE OPEN
-SQL > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION
When the master database cannot fail, the error of master-slave switching in the above way is as follows:
Database not available for switchover
End-Of-REDO archived log file has not been recovered
Archived log files detected beyond End-Of-REDO
Incomplete recovery SCN:0:1038219 archive SCN:0:1037990
Solution:
SQL > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH
-ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH FORCE
SQL > ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN
SQL > ALTER DATABASE OPEN
This is what the Oracle DG building shared by the editor is like. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.