In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Project
192.168.12.22 (main)
192.168.12.23 (from)
Oracle sid
Orcl
Orcl
Db_unique_name
Uniquepdg
Uniquesdg
Tnsname
Tns_pdg
Tns_sdg
1. Operation of the main library
Confirm whether the main library opens archiving and force logging
SQL > SHUTDOWN IMMEDIATE
SQL > STARTUP MOUNT
SQL > ALTER DATABASE ARCHIVELOG
SQL > ALTER DATABASE OPEN
SQL > ALTER DATABASE FORCE LOGGING
SQL > SELECT NAME,LOG_MODE,FORCE_LOGGING FROM v$DATABASE
Modify main library parameters
SQL > create pfile='/u01/pfile.ora' from spfile
SQL > alter system set db_unique_name=uniquepdg scope=both
SQL > alter system set log_archive_config='dg_config= (uniquepdg,uniquesdg) 'scope=both
SQL > alter system set log_archive_dest_1='location=/u01/arch valid_for= (all_logfiles,all_roles) db_unique_name=uniquepdg' scope=spfile
SQL > alter system set log_archive_dest_2='service=tns_sdg async valid_for= (online_logfile,primary_role) db_unique_name=uniquesdg' scope=both
SQL > alter system set remote_login_passwordfile=exclusive scope=spfile; / / defaults to exclusive
SQL > alter system set log_archive_max_processes=10 scope=both
Parameters about the standby role on the main library
SQL > alter system set fal_server=tns_sdg scope=both
SQL > alter system set db_file_name_convert='/u01/app/oracle/oradata','/u01/app/oracle/oradata' scope=spfile
SQL > alter system set log_file_name_convert='/u01/app/oracle/oradata','/u01/app/oracle/oradata' scope=spfile
SQL > alter system set standby_file_management=auto scope=both
Transfer pfile parameters from the library
Scp / u01/pfile2.ora 192.168.12.31:$ORACLE_HOME/dbs/
Copy password files from the main library
$cd $ORACLE_HOME/dbs
$scp orapworcl 192.168.12.23:$ORACLE_HOME/dbs/orapworcl
Second, operate from the library
Create the appropriate directory
$mkdir-p / u01/app/oracle/admin/orcl/adump
$mkdir-p / u01/oradata/orcl
$mkdir-p / u01/app/oracle/fast_recovery_area
$mkdir-p / u01/arch
$mkdir-p / u01/backup
The standby library is started with spfile
SQL > startup nomount pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/pfile2.ora'
SQL > create spfile from pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/pfile2.ora'
SQL > shutdown immediate
SQL > startup nomount
The main library is fully prepared.
Rman target /
Run {
Allocate channel d0 type disk
Allocate channel d1 type disk
Backup format'/ u01According backup02Accord fullbacks% ts% s% s% p 'database
Sql 'alter system archive log current'
Backup format'/ u01Accord backup02Universe Arcturt% ts% s% s% p 'archivelog all
Release channel d0
Release channel d1
}
Create an alternate control file
Backup current controlfile for standby format'/ u01Compact backup02Universe control01.ctl'
Copy backup files and backup control files to the standby library
$cd / u01/backup
$scp * 192.168.12.23:/u01/backup02
Restore control files from the library
$rman target /
RMAN > restore standby controlfile from'/ u01ax backup02control 01.ctl'
RMAN > alter database mount
Restore data files from the standby library
RMAN > restore database
The database is in mount state after RMAN > recover database;-- recovery is completed
Connected.
SQL > select open_mode from v$database
OPEN_MODE
-
MOUNTED
Main library:
ALTER DATABASE ADD STANDBY LOGFILE GROUP 4'/ u01qoradata size 50m
ALTER DATABASE ADD STANDBY LOGFILE GROUP 5'/ u01qoradata size 50m
ALTER DATABASE ADD STANDBY LOGFILE GROUP 6'/ u01qoradata size 50m
ALTER DATABASE ADD STANDBY LOGFILE GROUP 7'/ u01qoradata size 50m
Prepare the library:
ALTER DATABASE ADD STANDBY LOGFILE GROUP 4'/ u01qoradata 2max orclap sredo04.log' size 50m
ALTER DATABASE ADD STANDBY LOGFILE GROUP 5'/ u01qoradata 2max orclap sredo05.log' size 50m
ALTER DATABASE ADD STANDBY LOGFILE GROUP 6'/ u01qoradata 2max orclip size sredo06.log' 50m
ALTER DATABASE ADD STANDBY LOGFILE GROUP 7'/ u01qoradata 2max orclip size sredo07.log' 50m
3. Configure the main and standby database monitoring and tns files
The main library listens for files
$more / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = uniquepdg)
(ORACLE_HOME = / u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orclpdg)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.221) (PORT = 1521))
(ADDRESS = (PROTOCOL = TCP) (HOST = 172.168.0.221) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC0))
)
)
Standby library listening file
$more / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = uniquesdg)
(ORACLE_HOME = / u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orclsdg)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.222) (PORT = 1521))
(ADDRESS = (PROTOCOL = TCP) (HOST = 172.168.0.222) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC0))
)
)
Master and standby library tns files
$more / u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
TNS_PDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 172.168.0.221) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = uniquepdg)
)
)
TNS_SDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 172.168.0.222) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = uniquesdg)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
Standby library opens read-only mode
SQL > alter database open
/ / 10g cannot boot to read only mode, can only boot to mount mode
Standby database to start real-time application
SQL > alter database recover managed standby database using current logfile disconnect from session
III. Daily operation and maintenance management
Startup and shutdown of DG environment
Shutdown of the DG environment
Check the log usage of the master and slave libraries of the DG environment
Operation location: main library & standby library
SQL > archive log list
The log number currently used by the main database is the same as that of the standby database.
Stop the listener of the main library
Lsnrctl stop
Stop the listener of the library
Lsnrctl stop
Shut down the primary database
SQL > shutdown immediate
Check the open mode of the backup database.
SQL > select open_mode from v$database
If you find that the current database is in read only with apply mode, you need to close the archive log application by executing the following command
If you find that it is in read only mode, you can simply close the database. Normally, the repository should be in the mode of applying archive logs at all times.
Close the archiving application for the standby database
SQL > alter database recover managed standby database cancel
Close the standby database
SQL > shutdown immediate
In this way, the whole Data Guard environment is completely shut down.
Startup of DG environment
Start the main library of the DG environment
Sqlplus / as sysdba
SQL > startup
SQL > select status from v$instance
Start the listener of the main library
Lsnrctl start
Start the slave library of the DG environment to the mount or open state
Sqlplus / as sysdba
SQL > startup
SQL > startup mount
Start the listener of the standby library
Lsnrctl start
The main library switches the archive log
Operation command:
SQL > alter system archive log current
Check the repository to see if there are logs from new applications.
SQL > select sequence#,applied from v$archived_log
Start the archive log application process on the slave database
SQL > alter database recover managed standby database disconnect from session
The main database and standby database verify the current redo log
Operation location: main library & standby library
SQL > archive log list
If it is found that the number of the redo log currently used by the master database is the same as that of the slave database, it means that the rebooted DG environment is normal.
In this way, the Data Guard environment can be started normally.
Daily operation and maintenance operation
Check whether GAP exists in the master / slave database.
The main library checks current sequence#
SQL > select thread#,sequence#,status from v$log
THREAD# SEQUENCE# STATUS
1 847 INACTIVE
1 848 INACTIVE
1 849 CURRENT
The main library checks the sequence# being written by the LNS process
SQL > select process,sequence#,status from v$managed_standby
PROCESS SEQUENCE# STATUS
ARCH 847 CLOSING
ARCH 848 CLOSING
LNS 849 WRITING
Prepare the library to check the sequence# being applied
SQL > SELECT PROCESS,THREAD#,SEQUENCE#,STATUS FROM V$MANAGED_STANDBY
PROCESS THREAD# SEQUENCE# STATUS
--
ARCH 1 848 CLOSING
ARCH 1 847 CLOSING
MRP0 1 849 APPLYING_LOG
RFS 0 0 IDLE
RFS 1 849 IDLE
Check for the presence of GAP
SQL > SELECT THREAD#,LOW_SEQUENCE#,HIGH_SEQUENCE# FROM Variety ARCHIVEGAPThere you can determine that there is no GAP in the master / slave database, and you can switch to normal switchover.
Set linesize 300
Col DATABASE_ROLE for 20
Col DB_UNIQUE_NAME for a30
Col INSTANCE for a30
Col OPEN_MODE for a30
Col PROTECTION_MODE for a30
Col PROTECTION_LEVEL for a30
Col SWITCHOVER_STATUS for a30
SELECT DATABASE_ROLE, DB_UNIQUE_NAME INSTANCE, OPEN_MODE,PROTECTION_MODE, PROTECTION_LEVEL, SWITCHOVER_STATUS FROM V$DATABASE
Description of profile content
Main library
Orcl.__db_cache_size=264241152
Orcl.__java_pool_size=4194304
Orcl.__large_pool_size=71303168
Orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
Orcl.__pga_aggregate_target=314572800
Orcl.__sga_target=465567744
Orcl.__shared_io_pool_size=0
Orcl.__shared_pool_size=117440512
Orcl.__streams_pool_size=0
* .audit_file_dest='/u01/app/oracle/admin/orcl/adump'
* .audit_trail='db'
* .compatible='11.2.0.4.0'
* .control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/fast_recovery_area/orcl/control02.ctl'
* .db_block_size=8192
* .db_domain='segment2'
* .db_file_name_convert='/u01/app/oracle/oradata','/u01/app/oracle/oradata'
* .db_name='orcl'
* .db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
* .db_recovery_file_dest_size=4385144832
* .db_unique_name='UNIQUEPDG'
* .diagnostic_dest='/u01/app/oracle'
* .dispatchers=' (PROTOCOL=TCP) (SERVICE=orclXDB)'
* .fal_server='TNS_SDG'
* .log_archive_config='dg_config= (uniquepdg,uniquesdg)'
* .log_archive_dest_1='location=/u01/arch valid_for= (all_logfiles,all_roles) db_unique_name=uniquepdg'
* .log_archive_dest_2='service=tns_sdg async valid_for= (online_logfile,primary_role) db_unique_name=uniquesdg'
* .log_archive_max_processes=10
* .log_file_name_convert='/u01/app/oracle/oradata','/u01/app/oracle/oradata'
* .memory_target=780140544
* .open_cursors=300
* .processes=150
* .remote_login_passwordfile='EXCLUSIVE'
* .standby_file_management='AUTO'
* .undo_tablespace='UNDOTBS1'
From the library profile
Orcl.__db_cache_size=327155712
Orcl.__java_pool_size=4194304
Orcl.__large_pool_size=8388608
Orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
Orcl.__pga_aggregate_target=314572800
Orcl.__sga_target=465567744
Orcl.__shared_io_pool_size=0
Orcl.__shared_pool_size=117440512
Orcl.__streams_pool_size=0
* .audit_file_dest='/u01/app/oracle/admin/orcl/adump'
* .audit_trail='db'
* .compatible='11.2.0.4.0'
* .control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/fast_recovery_area/orcl/control02.ctl'
* .db_block_size=8192
* .db_domain='segment2'
* .db_file_name_convert='/u01/app/oracle/oradata','/u01/app/oracle/oradata'
* .db_name='orcl'
* .db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
* .db_recovery_file_dest_size=4385144832
* .db_unique_name='UNIQUESDG'
* .diagnostic_dest='/u01/app/oracle'
* .dispatchers=' (PROTOCOL=TCP) (SERVICE=orclXDB)'
* .fal_server='TNS_PDG'
* .log_archive_config='dg_config= (uniquepdg,uniquesdg)'
* .log_archive_dest_1='location=/u01/arch valid_for= (all_logfiles,all_roles) db_unique_name=uniquesdg'
* .log_archive_dest_2='service=tns_pdg async valid_for= (online_logfile,primary_role) db_unique_name=uniquepdg'
* .log_archive_max_processes=10
* .log_file_name_convert='/u01/app/oracle/oradata','/u01/app/oracle/oradata'
* .memory_target=780140544
* .open_cursors=300
* .processes=150
* .remote_login_passwordfile='EXCLUSIVE'
* .standby_file_management='AUTO'
* .undo_tablespace='UNDOTBS1'
Main library monitoring
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = uniquepdg)
(ORACLE_HOME = / u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.12.23) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = / u01/app/oracle
Monitor from the library
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = uniquesdg)
(ORACLE_HOME = / u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.12.23) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = / u01/app/oracle
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.