In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The subsidiary needs to build a data warehouse and build a new ADG as the master and slave, hardware equipment Dell R730 machine
192.168.1.11 dwjrdb-main library
192.168.1.12 dwjrstdyd-ready for library
-- Database software: linuxx64_12201_database.zip
-- Database patch: p27105253_122010_Linux-x86-64.zip
-- Opatch upgrade package: p6880880_122010_Linux-x86-64.zip
-- the directory is planned for / U01 to store archive logs, data files, etc., and directory 6.6TB space
1. The steps for database installation are as follows:
1. Turn off the firewall:
Systemctl stop firewalld
Systemctl disable firewalld
Systemctl stop firewalld.service
Systemctl disable firewalld.service
Chkconfig NetworkManager off
2. Configure the correspondence between hostname and IP address
Vi / etc/hosts adds the following
192.168.1.11 dwjrdb
192.168.1.12 dwjrstdydb
Modify the hostnames of both sides of the primary and standby database
/ etc/hostname
Dwjrdb
/ etc/hostname
Dwjrstdydb
3. Install the dependency package: (the oracle linux 7.2dependency package is as follows. For more information, please see the official documentation)
Yum clean all
Yum install-y binutils-
Yum install-y compat-libcap1-
Yum install-y compat-libstdc
Yum install-y glibc-
Yum install-y glibc-devel-
Yum install-y ksh
Yum install-y libaio-
Yum install-y libaio-devel
Yum install-y libX11-
Yum install-y libXau-
Yum install-y libXi-
Yum install-y libXtst-
Yum install-y libgcc-
Yum install-y libstdc
Yum install-y libstdc++-devel
Yum install-y libxcb-
Yum install-y make
Yum install-y nfs-utils-
Yum install-y net-tools-
Yum install-y smartmontools-
Yum install-y sysstat-
Yum install-y compat-libcap1
Yum install-y sysstat-
Yum install-y libaio-devel-
Yum install-y compat-libcap1-*
4. Close transparent hugepages and set hugepages
View transparent hugepage
Red Hat Enterprise Linux kernels:
Cat / sys/kernel/mm/redhat_transparent_hugepage/enabled
Other kernels:
Cat / sys/kernel/mm/transparent_hugepage/enabled
Oracle linux 7.2 does not enable transparent hugepages, ignore.
5. Add NTP time synchronization and execute it under root
[root@dwjrdb ~] # crontab-l
/ 5 * / usr/sbin/ntpdate 1.1.1.1 > / dev/null 2 > & 1
6. Users and groups:
Groupadd-g 501 oinstall
Groupadd-g 502 dba
Groupadd-g 503 oper
Groupadd-g 504 backupdba
Groupadd-g 505 dgdba
Groupadd-g 506 kmdba
Groupadd-g 507 racdba
/ usr/sbin/useradd-u 500-g oinstall-G oinstall,dba,oper,backupdba,dgdba,kmdba,racdba oracle
7. Catalogue:
Mkdir-p / u01/app/oraInventory
Chown-R oracle:oinstall / u01/app/oraInventory
Chmod-R 775 / u01/app/oraInventory
Mkdir-p / u01/app/oracle
Chown-R oracle:oinstall / u01/app/oracle
Chmod-R 775 / u01/app/oracle
Mkdir-p / u01/app/oracle/product/12.2.0/db_1
Chown-R oracle:oinstall / u01/app/oracle/product/12.2.0/db_1
Chmod-R 775 / u01/app/oracle/product/12.2.0/db_1
Mkdir-p / u01/arch
Chown-R oracle:oinstall / u01/arch
Chmod-R 775 / u01/arch
Prepare the library
Mkdir-p / u01/app/oracle/oradata/dwjrstdydb
Chown-R oracle:oinstall / u01/app/oracle/oradata/dwjrstdydb
Chmod-R 775 / u01/app/oracle/oradata/dwjrstdydb
8. Environmental variables
Main library:
Export ORACLE_SID=dwjrdb
Export ORACLE_BASE=/u01/app/oracle/
Export ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1
Export PATH=$ORACLE_HOME/bin:$PATH
Export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
Export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
Umask 022
Stty erase ^ h
Prepare the library:
Export PATH
Export ORACLE_SID=dwjrstdydb
Export ORACLE_BASE=/u01/app/oracle/
Export ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1
Export PATH=$ORACLE_HOME/bin:$PATH
Export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
Export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
Umask 022
Stty erase ^ h
9. Kernel parameters:
Vi / etc/sysctl.conf
Kernel.shmmax = 236223201280
Kernel.shmall = 57671680
Kernel.shmmni = 4096
Kernel.sem = 5010 641280 5010 128
Fs.file-max = 6815744
Net.ipv4.ip_local_port_range = 9000 65500
Net.core.rmem_default=1048576
Net.core.rmem_max=4194304
Net.core.wmem_default=262144
Net.core.wmem_max=1048576
Fs.aio-max-nr=1048576
Vm.swappiness = 0
Vm.nr_hugepages = 62850
-- Save effective
/ sbin/sysctl-p
10. Limit file: / etc/security/limits.conf
Oracle soft nproc 2047
Oracle hard nproc 16384
Oracle soft nofile 1024
Oracle hard nofile 65536
Oracle soft stack 10240
11. Vi / etc/pam.d/login file
Session required pam_limits.so
Vi / etc/profile
If [$USER = "oracle"] | | [$USER = "grid"]; then
If [$SHELL = "/ bin/ksh"]; then
Ulimit-p 16384
Ulimit-n 65536
Else
Ulimit-u 16384-n 65536
Fi
Umask 022
Fi
12. Start the graphical window to execute the databas database building script
A "error failed to start up and set export DISPLAY=:11 failed
B "directly use xmanager to log in to oracle users, and execute the installation script
13. After the creation is completed, dbca builds the database and netca creates the listening.
14. Only install sqlplus software on the backup end, not build the library.
15. Modify database parameters
Alter system set open_cursors=500 container=all
Alter system set processes=5000 scope=spfile
Alter system set db_files=5000 scope=spfile
Alter system set undo_retention=7200 scope=spfile
Alter system set "_ undo_autotune" = FALSE scope=spfile
Alter system set DEFERRED_SEGMENT_CREATION=false scope=spfile
16. Update the OPatch version, compress and replace OPatch directly, and type patch.
1. (1) upload p6880880_122010_Linux-x86-64.zip to the / u01/software directory, and / u01/software gives 777 permissions.
(2) rename the original OPatch directory under the root user.
Mv / u01/app/oracle/product/12.2.0/db_1/OPatch / u01/app/oracle/product/12.2.0/db_1/OPatchBAK
Oracle directory OPatch replacement
(1) root users
Cd / u01Accord; SoftwareCompact; oracle:oinstall p6880880_122010_Linux-x86-64.zip
(2) oracle users
Su-oracle cd / u01/software/; unzip p6880880_122010_Linux-x86-64.zip
(3) root users
Cd / u01 / mv OPatch / u01/app/oracle/product/12.1.0/db_1/
(4) oracle user testing
Su-oracle/ u01/app/oracle/product/12.1.0/db_1/OPatch/opatch version
Make a patch
[oracle@dwjrdb 27105253] $cd / software/27105253
[oracle@dwjrdb 27105253] $/ u01/app/oracle/product/12.2.0/db_1/OPatch/opatch apply
17. Set the startup parameters of pdb with cdb
Alter pluggable database all save state
18. Add data files and refer to the current history library
-- CDB--
ALTER DATABASE DATAFILE'/ u01 RESIZE RESIZE 01.dbf' oradata
ALTER DATABASE DATAFILE'/ u01 RESIZE RESIZE 5120m
ALTER DATABASE DATAFILE'/ u01 RESIZE RESIZE 01.dbf' oradat
ALTER DATABASE DATAFILE'/ u01 RESIZE RESIZE 8192 M
ALTER DATABASE TEMPFILE'/ u01 RESIZE RESIZE 1024m
-- pdb
Alter database datafile'/ u01 resize system 01.dbf' oradat 1024m
Alter database datafile'/ u01 resize resize 5120m
Alter database datafile'/ u01qqappActionoradata _ resize _ dwjrdbpdb_
Alter database datafile'/ u01 resize resize 30720m
Alter database tempfile'/ u01qapax resize oradat DWJRDB DWJRDB DWJRdbpdbDUP 01.dbf' oradata 30720m
-- add data files to the datacenter library
ALTER TABLESPACE UNDOTBS1 ADD DATAFILE'/ u01 SIZE SIZE DWjrdbDUTBS02.dbf' oradat 30720m
ALTER TABLESPACE UNDOTBS1 ADD DATAFILE'/ u01 SIZE SIZE 03.dbf' oradat 30720m
ALTER TABLESPACE UNDOTBS1 ADD DATAFILE'/ u01 SIZE SIZE 30720m
ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01 SIZE SIZE 30720m
ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01qapax SIZE oradat DWJRDB DWJRDB DWJRdbpdbDUP 03.dbf' oradat 30720m
ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01 SIZE SIZE 04.dbf' oradat
-- add redo log, initialize Redo too small, and eliminate all redo groups 1-3
Alter database add logfile group 4 ('/ u01ax size size 1024m)
Alter database add logfile member'/ u01 to group to group 4
Alter database add logfile group 5 ('/ u01ax size size 1024m)
Alter database add logfile member'/ u01 to group to group 5
-- remove redo group 1-3 and check that the redo status is INACTIVE and you can drop.
Select GROUP#,STATUS,MEMBERS from v$log
Alter database drop logfile group 1
Alter database drop logfile group 2
Alter database drop logfile group 3; it has always been current, so group 1 and 2 will be failback.
[oracle@dwjrdb ~] $cd / u01/app/oracle/oradata/dwjrdb/
[oracle@dwjrdb dwjrdb] $rm-rf redo01.log redo02.log
Alter database add logfile group 1 ('/ u01ax size size 1024m)
Alter database add logfile member'/ u01 to group to group DwjrDB to group redo01b
Alter database add logfile group 2 ('/ u01ax size size 1024m)
Alter database add logfile member'/ u01 to group to group 2
Alter database drop logfile group 3;-- the log is inactive after logging
[oracle@dwjrdb ~] $cd / u01/app/oracle/oradata/dwjrdb/
[oracle@dwjrdb dwjrdb] $rm-rf redo03.log
Alter database add logfile group 3 ('/ u01ax size size 1024m)
Alter database add logfile member'/ u01 to group to group 3
-- add control files--
SQL > select name from v$controlfile
/ u01/app/oracle/oradata/dwjrdb/control01.ctl
/ u01/app/oracle/oradata/dwjrdb/control02.ctl
-- add control files
Alter system set control_files='/u01/app/oracle/oradata/dwjrdb/control01.ctl','/u01/app/oracle/oradata/dwjrdb/control02.ctl','/u01/app/oracle/oradata/dwjrdb/control03.ctl' scope=spfile
Shutdown immediate
Cp control01.ctl control03.ctl
Startup
SQL > select name from v$controlfile
NAME
/ u01/app/oracle/oradata/dwjrdb/control01.ctl
/ u01/app/oracle/oradata/dwjrdb/control02.ctl
/ u01/app/oracle/oradata/dwjrdb/control03.ctl
Second, the steps of building ADG
192.168.1.11 dwjrdb-main library
192.168.1.12 dwjrstdydb-prepare the library-install the database software, upgrade the database to opatch and patch the database after configuring dg
1. Modify the active and standby listening files
Main library: listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = dwjrdb) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dwjrdb)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrdb)
)
(SID_DESC =
(GLOBAL_DBNAME = dwjrstdydb)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrstdydb)
)
)
If broker is configured, it needs to be added to listener.ora.
(SID_DESC =
(GLOBAL_DBNAME = dwjrdb_DGMGRL)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrdb)
)
-- tnsnames.ora
Dwjrdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.11) (PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dwjrdb)
)
)
Dwjrstdydb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.12) (PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dwjrstdydb)
)
)
-- preparation of the library
-- listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dwjrdb)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrdb)
)
(SID_DESC =
(GLOBAL_DBNAME = dwjrstdydb)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrstdydb)
)
)
-- tnsnames.ora
Dwjrdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.11) (PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dwjrdb)
)
)
Dwjrstdydb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 1192.168.1.12) (PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dwjrstdydb)
)
)
-- restart the monitoring of the primary and secondary database
Lsnrctl reload
-- testing
Tnsping dwjrdb
Tnsping dwjrstdydb
Sqlplus sys/VgdAJ9ZeNw2B@dwjrdb as sysdba
Sqlplus sys/VgdAJ9ZeNw2B@dwjrstdydb as sysdba
2. Modify the necessary parameters of the main database (which can be executed in CDB)
Select force_logging from vault database;-- query whether it is enabled
Alter database force logging;-- enables mandatory logging
Alter database archivelog;-- starts archiving
Alter system set standby_file_management=auto;-- manual
Alter system set log_archive_dest_1='location=/u01/arch valid_for= (all_logfiles,all_roles) db_unique_name=dwjrdb' scope=spfile;-- enables local archiving
Alter system set log_archive_dest_2='SERVICE=dwjrstdydb LGWR ASYNC valid_for= (all_logfiles,all_roles) db_unique_name=dwjrstdydb' scope=spfile;-- enables remote archiving
Alter system set log_archive_config='dg_config= (dwjrdb,dwjrstdydb)';-- enable DG function
Alter system set fal_client='dwjrdb';-- specifies the source side
Alter system set fal_server='dwjrstdydb';-- specifies the destination side
Alter system set log_archive_dest_state_2=enable;-- launches the application
Alter system set log_archive_dest_state_1=enable;-- launches the application
Alter system set log_archiveformat='dwjrdb%t%s_%r.dbf' scope=spfile;-- specifies the format of the archive file
-- Source side-- write the standby address first, and then write the address on the source side
Alter system set db_file_name_convert='/u01/app/oracle/oradata/dwjrstdydb/','/u01/app/oracle/oradata/dwjrdb/' scope=spfile
Alter system set log_file_name_convert='/u01/app/oracle/oradata/dwjrstdydb/','/u01/app/oracle/oradata/dwjrdb/' scope=spfile
Select bytes/1024/1024 from vault log ownership-query log size
Select member from vault log file share-query log location
Number and size of select GROUP#,BYTES/1024/1024/1024 G from vault log shares-query groups
Select group#,thread#,members,archived,status from vault logscape-query which log group is currently being used
-- add standby logfile
Alter database add standby logfile group 6 ('/ u01qapax orby06a.log')
'/ u01Applink size size oradataPlacement dwjrdbandstandby06b.log')
Alter database add standby logfile group 7 ('/ u01qapax oracle.oradataUnixxxxxxxxxxxxxxxx
'/ u01Applink size size oradataUniplex dwjrdbstandby07b.log')
Alter database add standby logfile group 8 ('/ u01qapqqoracle.oradataUnixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'/ u01Applink size size oradataPlacement dwjrdbandstandby08b.log')
Alter database add standby logfile group 9 ('/ u01qapax oracleUnixoradataUnixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'/ u01appranumoracle.oradata size dwjrdbandstandby09b.log') Oracle 1G
Alter database add standby logfile group 10 ('/ u01qapax oracle.oradataUnixxxxxxxxxxxxxxxx
'/ u01Applicon size oradata size dwjrdbandstandby10b.log')
Alter database add standby logfile group 11 ('/ u01qapax oracleUnixoradataUnixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'/ u01Applink size size oradataDwjrdbandstandby11b.log')
-restart the main database to make the modified parameters take effect
Shut immediate
Startup
-generate pfile file
Create pfile from spfile
-pass password file
Cd $ORACLE_HOME/dbs
Scp orapwdwjrdb 192.168.1.12:/u01/app/oracle/product/12.2.0/db_1/dbs/orapwdwjrstdydb
-pass parameter file
Cd $ORACLE_HOME/dbs
Scp initdwjrdb.ora 192.168.1.12:/u01/app/oracle/product/12.2.0/db_1/dbs/initdwjrstdydb.ora
3. Modify the parameters related to initteststdydb.ora in the database parameter file.
-- create an audit_file_dest directory (change it to a standby database)
Mkdir-p / u01/app/oracle/admin/dwjrstdydb/adump
-- create a control_files path
Mkdir-p / u01/app/oracle/oradata/dwjrstdydb
-- modify db_file_name_convert and log_file_name_convert paths
.db _ file_name_convert='/u01/app/oracle/oradata/dwjrdb','/u01/app/oracle/oradata/dwjrstdydb'
.log _ file_name_convert='/u01/app/oracle/oradata/dwjrdb','/u01/app/oracle/oradata/dwjrstdydb'
-- add db_unique_name parameter
* .db_unique_name='dwjrstdydb'
-modify the following parameters
.fal _ client='dwjrstdydb'
.fal _ server='dwjrdb'
* .log_archive_dest_1='location=/u01/arch valid_for= (all_logfiles,all_roles) db_unique_name=dwjrstdydb'
* .log_archive_dest_2=''
* .log_archiveformat='dwjrstdydb%t%s%r.arc'
-- modify the path of the slave control file, because it is copied, and the file directory is still the original one.
-- start the backup library to nomount
Startup nomount
4. The main library performs the recovery operation.
Rman target sys/VgdAJ9ZeNw2B@dwjrdb auxiliary sys/VgdAJ9ZeNw2B@dwjrstdydb
Duplicate target database for standby nofilenamecheck from active database
-- return the result
Datafile 10 switched to datafile copy
Input datafile copy RECID=10 STAMP=980117877 file name=/u01/app/oracle/oradata/dwjrstdydb/dwjrdbpdb/undotbs01.dbf
Datafile 11 switched to datafile copy
Input datafile copy RECID=11 STAMP=980117877 file name=/u01/app/oracle/oradata/dwjrstdydb/dwjrdbpdb/users01.dbf
Datafile 12 switched to datafile copy
Input datafile copy RECID=12 STAMP=980117877 file name=/u01/app/oracle/oradata/dwjrstdydb/dwjrdbpdb/undotbs02.dbf
Datafile 13 switched to datafile copy
Input datafile copy RECID=13 STAMP=980117877 file name=/u01/app/oracle/oradata/dwjrstdydb/dwjrdbpdb/undotbs03.dbf
Datafile 14 switched to datafile copy
Input datafile copy RECID=14 STAMP=980117877 file name=/u01/app/oracle/oradata/dwjrstdydb/dwjrdbpdb/undotbs04.dbf
Finished Duplicate Db at 29-JUN-18
-after the above operation is completed, the slave database will be in mount status.
Alter database open;--- master library
-prepare database application log
Alter database recover managed standby database using current logfile disconnect from session
Alter database recover managed standby database cancel;--- cancels the application
-- query whether the database log is applied
Select sequence#,applied from v$archived_log
-query whether the database preparation process is normal
Select process,client_process,sequence#,status from v$managed_standby
SQL > select process, status, thread#,sequence#, block#, blocks from v$managed_standby
PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS
MRP0 APPLYING_LOG 1 110 86 2097152
-query the status of master and slave libraries
Select DATABASE_ROLE,SWITCHOVER_STATUS from v$database
5. Verification
-- create a test table a; add, delete and modify it; verify whether it is synchronized in the standby database
Create table a (an int)
3. Configure dg borker
1. Modify the listening file and tns file of the master and slave database.
Main library listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dwjrdb)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrdb)
)
(SID_DESC =
(GLOBAL_DBNAME = dwjrstdydb)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrstdydb)
)
(SID_DESC =
(GLOBAL_DBNAME = dwjrdb_DGMGRL)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrdb)
)
)
Reserve library listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dwjrdb)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrdb)
)
(SID_DESC =
(GLOBAL_DBNAME = dwjrstdydb)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrstdydb)
)
(SID_DESC =
(GLOBAL_DBNAME = dwjrstdydb_DGMGRL)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = dwjrstdydb)
)
)
The pdb in the tnsname file of the main library is 11.11 when it was first built.
[oracle@dwjrdb ~] $more / u01/app/oracle/product/12.2.0/db_1/network/admin/tnsnames.ora
DWJRDBPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.11) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DWJRDBPDB)
)
)
Prepare the library tnsnames. The ora file is when it was first built, so the ip is 11.11, changed to 11.12.
[oracle@dwjrstdydb admin] $vi tnsnames.ora
DWJRDBPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.12) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DWJRDBPDB)
)
)
2. Set dg_broker_start=true for both instances.
Primary:
Alter system set dg_broker_start=true
Standby:
Alter system set dg_broker_start=true
Dgmgrl sys/VgdAJ9ZeNw2B@dwjrdb
Create CONFIGURATION dwjrdb_dg as primary database is dwjrdb CONNECT IDENTIFIER IS dwjrdb
Add database dwjrstdydb as CONNECT IDENTIFIER IS dwjrstdydb MAINTAINED AS PHYSICAL
Enable configuration
Show configuration
Switchover to dwjrstdydb
Switchover to dwjrdb
Show database verbose dwjrstdydb
-- the following execution process found an error. The standby database is directly modified by the pfile of the main library, but the primary database is spfile and the standby database is pfile.
[oracle@dwjrdb ~] $dgmgrl sys/VgdAJ9ZeNw2B@dwjrdb
DGMGRL for Linux: Release 12.2.0.1.0-Production on Mon Jul 2 10:48:32 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected to "dwjrdb"
Connected as SYSDBA.
DGMGRL > create CONFIGURATION dwjrdb_dg as primary database is dwjrdb CONNECT IDENTIFIER IS dwjrdb
Configuration "dwjrdb_dg" created with primary database "dwjrdb"
DGMGRL > add database dwjrstdydb as CONNECT IDENTIFIER IS dwjrstdydb MAINTAINED AS PHYSICAL
Database "dwjrstdydb" added
DGMGRL > enable configuration
Enabled.
DGMGRL > show configuration
Configuration-dwjrdb_dg
Protection Mode: MaxPerformance
Members:
Dwjrdb-Primary database
Dwjrstdydb-Physical standby database
Error: ORA-16797: member is not using a server parameter file
Fast-Start Failover: DISABLED
Configuration Status:
ERROR (status updated 1 second ago)
DGMGRL >
-- the parameter files on both sides are inconsistent. The main library is spfile, and the slave database is pfile, so generate the spfile of the slave database, and then restart the instance.
DGMGRL > remove database dwjrdb
DGMGRL > remove database dwjrstdydb
DGMGRL > remove configuration
-delete the backup database parameter dg_broker_start is invalid, and an error is reported
SQL > show parameter dg_broker_start
NAME TYPE VALUE
Dg_broker_start boolean FALSE
SQL > alter system set dg_broker_start=true
-- re-execute the above command
Create CONFIGURATION dwjrdb_dg as primary database is dwjrdb CONNECT IDENTIFIER IS dwjrdb
Add database dwjrstdydb as CONNECT IDENTIFIER IS dwjrstdydb MAINTAINED AS PHYSICAL
Enable configuration
-- specific process
[oracle@dwjrdb trace] $dgmgrl sys/VgdAJ9ZeNw2B@dwjrdb
DGMGRL for Linux: Release 12.2.0.1.0-Production on Mon Jul 2 14:55:53 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected to "dwjrdb"
Connected as SYSDBA.
DGMGRL > add database dwjrstdydb as CONNECT IDENTIFIER IS dwjrstdydb MAINTAINED AS PHYSICAL
Database "dwjrstdydb" added
DGMGRL > enable configuration
Enabled.
DGMGRL > show configuration
Configuration-dwjrdb_dg
Protection Mode: MaxPerformance
Members:
Dwjrdb-Primary database
Dwjrstdydb-Physical standby database (disabled)
ORA-16795: the standby database needs to be re-created-- New error report
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 5 seconds ago)
DGMGRL > show database dwjrstdydb
Database-dwjrstdydb
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: (unknown)
Apply Lag: (unknown)
Average Apply Rate: (unknown)
Real Time Query: OFF
Instance (s):
Dwjrstdydb
Database Status:
ORA-16795: the standby database needs to be re-created
-- solution
DGMGRL > enable database dwjrstdydb
Enabled.
DGMGRL > show database dwjrstdydb
Database-dwjrstdydb
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 8 seconds ago)
Apply Lag: 0 seconds (computed 8 seconds ago)
Average Apply Rate: 5.00 KByte/s
Real Time Query: ON
Instance (s):
Dwjrstdydb
Database Status:
SUCCESS
DGMGRL > show database verbose dwjrstdydb
Database-dwjrstdydb
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 11 seconds ago)
Apply Lag: 0 seconds (computed 11 seconds ago)
Average Apply Rate: 5.00 KByte/s
Active Apply Rate: (unknown)
Maximum Apply Rate: (unknown)
Real Time Query: ON
Instance (s):
Dwjrstdydb
Properties:
DGConnectIdentifier = 'dwjrstdydb'
ObserverConnectIdentifier =''
LogXptMode = 'ASYNC'
RedoRoutes =''
DelayMins ='0'
Binding = 'optional'
MaxFailure ='0'
MaxConnections ='1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance =''
ApplyInstanceTimeout ='0'
ApplyLagThreshold = '30'
TransportLagThreshold = '30'
TransportDisconnectedThreshold = '30'
ApplyParallel = 'AUTO'
ApplyInstances ='0'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget ='0'
LogArchiveMaxProcesses ='4'
LogArchiveMinSucceedDest ='1'
DataGuardSyncLatency ='0'
DbFileNameConvert ='/ u01/app/oracle/oradata/dwjrdb, / u01ActionAccord oradata Dwjrstdydb'
LogFileNameConvert ='/ u01/app/oracle/oradata/dwjrdb, / u01ActionAccord oradata Dwjrstdydb'
FastStartFailoverTarget =''
InconsistentProperties ='(monitor)'
InconsistentLogXptProps ='(monitor)'
SendQEntries ='(monitor)'
LogXptStatus ='(monitor)'
RecvQEntries ='(monitor)'
PreferredObserverHosts =''
StaticConnectIdentifier ='(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=dwjrstdydb) (PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=dwjrstdydb_DGMGRL) (INSTANCENAME=dwjrstdydb) (SERVER=DEDICATED)'
StandbyArchiveLocation ='/ u01Universe Archy'
AlternateLocation =''
LogArchiveTrace ='0'
LogArchiveFormat = 'dwjrstdydb%t%s%r.arc'
TopWaitEvents ='(monitor)'
Log file locations:
Alert log: / u01/app/oracle/diag/rdbms/dwjrstdydb/dwjrstdydb/trace/alert_dwjrstdydb.log
Data Guard Broker log: / u01/app/oracle/diag/rdbms/dwjrstdydb/dwjrstdydb/trace/drcdwjrstdydb.log
Database Status:
SUCCESS
-- switch to switch the main database to the standby database
Switchover to dwjrstdydb
DGMGRL > switchover to dwjrstdydb
Performing switchover NOW, please wait...
Operation requires a connection to database "dwjrstdydb"
Connecting...
Connected to "dwjrstdydb"
Connected as SYSDBA.
New primary database "dwjrstdydb" is opening...
Operation requires start up of instance "dwjrdb" on database "dwjrdb"
Starting instance "dwjrdb"...
ORACLE instance started.
Database mounted.
Database opened.
Connected to "dwjrdb"
Switchover succeeded, new primary is "dwjrstdydb"
Switchover to dwjrdb
DGMGRL > switchover to dwjrdb
Performing switchover NOW, please wait...
New primary database "dwjrdb" is opening...
Operation requires start up of instance "dwjrstdydb" on database "dwjrstdydb"
Starting instance "dwjrstdydb"...
ORACLE instance started.
Database mounted.
Database opened.
Connected to "dwjrstdydb"
Switchover succeeded, new primary is "dwjrdb"
-- Test deletion of testpdb
SQL > alter pluggable database TESTPDB close
Pluggable database altered.
SQL > show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED 2 PDB$SEED READ ONLY NO 3 DWJRDBPDB READ WRITE NO 5 TESTPDB MOUNTED
SQL > drop pluggable database TESTPDB including datafiles;-including deletion of all data files
Prepare database query
SQL > show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED 2 PDB$SEED READ ONLY NO 3 DWJRDBPDB READ ONLY NO 5 TESTPDB READ ONLY NO
SQL > show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED 2 PDB$SEED READ ONLY NO 3 DWJRDBPDB READ ONLY NO
-- create a soft connection under home
Ln-s / u01/app/oracle/diag/rdbms/dwjrdb/dwjrdb/trace trace
The deployment of the production environment has been completed, and the 12C DG environment has been able to switch between master and standby, and the data synchronization is consistent. Let Xiaobai refer to this document and can also build his own DG~.
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.