In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Groupadd oinstall
Groupadd dba
Groupadd oper
Groupadd asmadmin
Groupadd asmdba
Groupadd asmoper
Useradd-g oinstall-G dba,asmdba,asmadmin,asmoper grid
Useradd-g oinstall-G dba,oper,asmdba oracle
Passwd grid
Passwd oracle
Mkdir-p / u01/app/11.2.0/grid
Mkdir-p / u01/app/grid
Mkdir-p / u01/app/oracle
Chown grid:oinstall / u01/app/11.2.0/grid
Chown grid:oinstall / u01/app/grid
Chown-R oracle:oinstall / u01/app/oracle
Chmod-R 775 / u01 /
Chown-R grid:oinstall / U01
Sed-I's max kernel.shmmax _ max _ etc/sysctl.conf
Sed-I'sUniverse kernel.shmallGrexample kernel.shmallGrexel / etc/sysctl.conf
Vi / etc/sysctl.conf
Add the following:
Fs.aio-max-nr = 1048576
Fs.file-max = 6815744
Kernel.shmall = 2097152
Kernel.shmmax = 1073741824
Kernel.shmmni = 4096
Kernel.sem = 250 32000 100 128
Net.ipv4.ip_local_port_range = 9000 65500
Net.core.rmem_default = 262144
Net.core.rmem_max = 4194304
Net.core.wmem_default = 262144
Net.core.wmem_max = 1048586
Sysctl-p
Vi / etc/security/limits.conf
Add the following:
Oracle soft nproc 2047
Oracle hard nproc 16384
Oracle soft nofile 1024
Oracle hard nofile 65536
Oracle soft stack 10240
Grid soft nproc 2047
Grid hard nproc 16384
Grid soft nofile 1024
Grid hard nofile 65536
Grid soft stack 10240
Vi / etc/profile writes the following:
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
Export PATH=$PATH:/u01/app/11.2.0/grid/bin
Configure Node rac1
Grid users:
Vi .bash _ profile
Export TMP=/tmp
Export TMPDIR=$TMP
Export ORACLE_HOSTNAME=
Export ORACLE_SID=
Export ORACLE_BASE=/u01/app/grid
Export ORACLE_HOME=/u01/app/11.2.0/grid
Export PATH=$ORACLE_HOME/bin:$PATH
Oracle users:
Vi .bash _ profile
Export TMP=/tmp
Export TMPDIR=$TMP
Export ORACLE_HOSTNAME=
Export ORACLE_BASE=/u01/app/oracle
Export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
Export ORACLE_UNQNAME=
Export ORACLE_SID=
Export ORACLE_TERM=xterm
Export PATH=/usr/sbin:$PATH
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
1. Install the database software separately
two。 Build the main library by dbca
3. Master / standby netca
4. The main library executes:
Select * from v$option where parameter = 'Managed Standby'
Archive log list
Alter database force logging
Alter database add standby logfile group 4 ('/ u01 size) size 50m
Alter database add standby logfile group 5 ('/ u01 size) size 50m
Alter database add standby logfile group 6 ('/ u01 size) size 50m
Alter database add standby logfile group 7 ('/ u01 size) size 50m
Create pfile from spfile
Show parameter name
Alter system set db_unique_name='ora11g_primary' scope=spfile
Alter system set log_archive_config='dg_config= (ora11g_primary,ora11g_standby)'
Create pfile from spfile
Shutdown immediate
Cd / u01/app/oracle/product/11.2.0/db_1/dbs
Check to see if initora11g.org db_unique_name='ora11g_primary' has
Startup
Alter system set log_archive_dest_1='location=/u01/app/oracle/archivelog valid_for= (ALL_LOGFILES,ALL_ROLES) db_unique_name=ora11g_primary'
Alter system set log_archive_dest_2='service=ora11g_standby LGWR SYNC valid_for= (ONLINE_LOGFILES,primary_role) db_unique_name=ora11g_standby'
Alter system set log_archive_dest_state_1='enable'
Alter system set log_archive_dest_state_2='enable'
Alter system set REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE' scope=spfile
Alter system set FAL_SERVER='ora11g_standby' scope=spfile
Alter system set FAL_client='ora11g_primary' scope=spfile
Alter system set STANDBY_FILE_MANAGEMENT='AUTO' scope=spfile
Mkdir-p $ORACLE_BASE/archivelog
Create pfile from spfile
Shutdown immediate
Verify that the parameters are all in
Startup mount
Alter database create standby controlfile as'/ u01bind standbyrabbit ctl02.ctl'
Cd / u01/app/oracle/product/11.2.0/db_1/network/admin
Vim listener.ora
Add
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = ora11g)
(ORACLE_HOME = / u01/app/oracle/product/11.2.0/db_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = cbfdb1) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = / u01/app/oracle
Vim tnsnames.ora
ORA11G_PRIMARY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.1) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora11g)
)
)
ORA11G_STANDBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.2) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora11g)
)
)
Shut down the primary database
SQL > shutdown immediate
Generate spfile
SQL > create spfile from pfile
5. Execute in the standby section:
Mkdir-p $ORACLE_BASE/oradata/ora11g
Mkdir-p $ORACLE_BASE/admin/ora11g
Mkdir-p $ORACLE_BASE/admin/ora11g/adump
Mkdir-p $ORACLE_BASE/admin/ora11g/bdump
Mkdir-p $ORACLE_BASE/admin/ora11g/cdump
Mkdir-p $ORACLE_BASE/admin/ora11g/dpdump
Mkdir-p $ORACLE_BASE/admin/ora11g/pfile
Mkdir-p $ORACLE_BASE/admin/ora11g/udump
Mkdir-p $ORACLE_BASE/diag/rdbms
Mkdir-p $ORACLE_BASE/diag/tnslsnr
Mkdir-p $ORACLE_BASE/fast_recovery_area/ORA11G
Mkdir-p $ORACLE_BASE/archivelog
The following scp is executed in the main library
Scp-r $ORACLE_BASE/oradata/ora11g/*.dbf 192.168.0.2:/$ORACLE_BASE/oradata/ora11g
Scp-r $ORACLE_BASE/oradata/*.log 192.168.0.2:/$ORACLE_BASE/oradata
Scp-r / u01/standby_ctl01.ctl 192.168.0.2:/$ORACLE_BASE/oradata
Scp-r $ORACLE_HOME/dbs/initora11g.ora 192.168.0.2: $ORACLE_HOME/dbs/
Scp-r / u01/app/oracle/product/11.2.0/db_1/dbs/orapwora11g 192.168.0.2:/u01/app/oracle/product/11.2.0/db_1/dbs/
$cd $ORACLE_BASE/oradata/ora11g
$mv standby_ctl01.ctl control01.ctl
$cp control01.ctl control02.ctl
Cd / u01/app/oracle/product/11.2.0/db_1/dbs
Modify initora11g.ora
DB_UNIQUE_NAME=ora11g_standby
LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/archivelog VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ora11g_standby'
LOG_ARCHIVE_DEST_2='SERVICE=ora11g_primary LGWR SYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ora11g_primary'
FAL_SERVER=ora11g_primary
FAL_CLIENT=ora11g_standby
Cd / u01/app/oracle/product/11.2.0/db_1/network/admin
Vim listener.ora
Add
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = ora11g)
(ORACLE_HOME = / u01/app/oracle/product/11.2.0/db_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = cbfdb2) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = / u01/app/oracle
Vim tnsnames.ora
ORA11G_PRIMARY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.1) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora11g)
)
)
ORA11G_STANDBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.2) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora11g)
)
)
Startup nomount
Alter database mount standby database
The main library executes:
Startup mount
Alter database set standby database to maximize availability; (set to highest availability mode)
Alter database open
SQL > alter database recover managed standby database disconnect from session
# after executing this command, the slave database will switch to automatic recovery mode
I. function switching
Switchover status switching
First, operate on primary:
(1)。 Verify whether the primary database can perform the role transition to the standby database (the original primary database executes)
SQL > SELECT SWITCHOVER_STATUS FROM V$DATABASE
SWITCHOVER_STATUS
-
TO STANDBY
1 row selected
(2) start to change the physical master database into a physical backup database (the original primary database is executed)
SQL > ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY
Or
SQL > ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY with session shutdown
Note: if there is an active session, you can use this option, otherwise the conversion will encounter ORA-01093 errors, or you can kill the active session or wait for the active session to switch.
(3)。 Shut down and restart the main library (the original primary library executes)
SQL > shutdown immediate
SQL > startup nomount
SQL > alter database mount standby database; # keep the slave library in standby
SQL > alter database recover managed standby database using current logfile disconnect from session; # start real-time synchronization
Then operate on standby:
(1)。 Verify whether the standby library can perform the role transition to the primary library (the original library executes)
SQL > SELECT SWITCHOVER_STATUS FROM V$DATABASE
SWITCHOVER_STATUS
-
TO_PRIMARY
1 row selected
(2)。 Start to convert the physical backup library to the physical master library (execution of the original library)
SQL > ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY
-- if ORA-16139: media recovery required is reported, it may be caused by not applying the log. You can execute it first.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION
(3) Open the standby library, then close and restart it. (execution of the original library)
SQL > SHUTDOWN IMMEDIATE
SQL > STARTUP
(4) verify whether the conversion is successful (execution of the original library)
SQL > ALTER SYSTEM SWITCH LOGFILE
Start the log application
(5) Application Archive Log (executed on the original master database)
SQL > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION
Tip: to successfully implement switchover, it's best to set some initialization parameters for both primary and standby on each server, although some of these parameters only work on one of primary or standby.
4. Startup and shutdown sequence
Startup sequence
(1)。 Snooping Listener of Kai Slave and Master Library
From the library DG-Standby:
$lsnrctl start
Main library DG-Primary:
$lsnrctl start
(2)。 Start the standby database and execute as follows:
$sqlplus / nolog
SQL > conn / as sysdba
SQL > startup nomount
SQL > alter database mount standby database; # keep the slave library in standby
SQL > alter database recover managed standby database using current logfile disconnect from session; # start real-time synchronization
(3)。 Start the main library
$sqlplus / nolog
SQL > conn / as sysdba
SQL > startup
Switch from standby database to read only mode
SQL > alter database recover managed standby database cancel; # first cancel the automatic recovery mode of database preparation
SQL > alter database open read only
If you want to switch back to recover manage mode (start the log application or start the log real-time application)
SQL > alter database recover managed standby database disconnect from session; starts log application
SQL > alter database recover managed standby database using current logfile disconnect from session; starts real-time log application
(3)。 Start the main database (after the second step above is complete, you can execute the following command):
SQL > startup
Closing order
On the contrary, close the master library first, and then close the slave library.
(1)。 Close the main library
$su-oracle
SQL > sqlplus / nolog
SQL > conn / as sysdba
SQL > shutdown immediate
(2)。 Close the slave library
Su-oracle
SQL > sqlplus / nolog
SQL > conn / as sysdba
SQL > alter database recover managed standby database cancel; # stop synchronization
SQL > shutdown immediate
Emergency handover
(note: the simulation main database cannot switchover properly due to failure, so you need to execute failover, force the backup library-> pridb and take over the business)
(1)。 Prepare the library:
Since it is failover, it is understood that the main library can no longer be used properly at this time. Just switch to pridb for the backup library.
Stop applying the recovery model
Alter database recover managed standby database finish
Convert standbydb to primary db
Alter database commit to switchover to primary
Restart the database and resume normal business
SQL > shutdown immediate
SQL > startup
Select open_mode,database_role from v$database
OPEN_MODE DATABASE_ROLE
--
OPEN PRIMARY
Note: failover will break the dataguard mode and need to reconfigure dataguard. It is also said on the Internet that it does not need to be configured, but the test has not been successful.
Select dbid,name,protection_mode,protection_level from v$database
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.