Springboot——攔截器
阿新 • • 發佈:2020-11-16
[oracle@monkey01 ~]$ sqlplus / as sysdba SQL> alter database force logging; Database altered. SQL> col force_logging for a15 SQL> select force_logging from v$database; FORCE_LOGGING --------------- YES SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 35 Next log sequence to archive 37 Current log sequence 37 SQL> alter system set db_unique_name='monkeymdb' scope=spfile; SQL> alter system set log_archive_config='dg_config=(monkeymdb,monkeysdb)' scope=spfile; SQL> alter system set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=monkeymdb' scope=spfile; SQL> alter system set log_archive_dest_2='service=monkeysdb lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=monkeysdb' scope=spfile; SQL> alter system set fal_server='monkeysdb' scope=spfile; SQL> alter system set standby_file_management='auto' scope=spfile; SQL> alter system set log_archive_dest_state_2='defer' scope=spfile; SQL> alter system set service_names=monkeydb,monkeymdb scope=spfile; [oracle@monkey01 ~]$ cd $ORACLE_HOME/dbs [oracle@monkey01 dbs]$ sqlplus / as sysdba SQL> create pfile from spfile; File created. [oracle@monkey01 dbs]$ scp initmonkeydb.ora 192.168.1.202:/u01/app/oracle/product/11.2.0/db_1/dbs [oracle@monkey01 dbs]$ scp orapwmonkeydb 192.168.1.202:/u01/app/oracle/product/11.2.0/db_1/dbs [oracle@monkey01 ~]$ mkdir backup [oracle@monkey02 ~]$ mkdir backup [oracle@monkey01 ~]$ rman target / RMAN> backup device type disk format '/home/oracle/backup/%U' database plus archivelog; RMAN> backup device type disk format '/home/oracle/backup/%U' current controlfile for standby; [oracle@monkey01 ~]$ scp /home/oracle/backup/* 192.168.1.202:/home/oracle/backup [oracle@monkey01 ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora monkeymdb = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.201)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = monkeydb) ) ) monkeysdb = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.202)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = monkeydb) ) ) [oracle@monkey02 ~]$ vi $ORACLE_HOME/network/admin/listener.ora SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = monkeydb) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1) (SID_NAME = monkeydb) ) ) LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = monkey02)(PORT = 1521)) ) ADR_BASE_LISTENER = /u01/app/oracle [oracle@monkey02 ~]$ lsnrctl start [oracle@monkey02 ~]$ lsnrctl status [oracle@monkey02 ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora monkeymdb = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.201)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = monkeydb) ) ) monkeysdb = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.202)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = monkeydb) ) ) [oracle@monkey01 ~]$ tnsping monkeysdb Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.202)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = monkeydb))) OK (40 msec) [oracle@monkey02 ~]$ tnsping monkeymdb Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.201)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = monkeydb))) OK (30 msec) [oracle@monkey02 ~]$ cd $ORACLE_HOME/dbs [oracle@monkey02 dbs]$ vi initambdb.ora *.audit_file_dest='/u01/app/oracle/admin/monkeydb/adump' *.audit_trail='db' *.compatible='11.2.0.4.0' *.control_files='/u01/app/oracle/oradata/ambdb/control01.ctl','/u01/app/oracle/fast_recovery_area/ambdb/control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='monkeydb' *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area' *.db_recovery_file_dest_size=107374182400 *.db_unique_name='monkeysdb' *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=monkeydbXDB)' *.fal_server='monkeymdb' *.log_archive_config='dg_config=(monkeymdb,monkeysdb)' *.log_archive_dest_1='location=db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=monkeysdb' *.log_archive_dest_2='service=monkeymdb lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=monkeymdb' *.memory_max_target=1073741824 *.memory_target=1073741824 *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.service_names='monkeydb','monkeysdb' *.standby_file_management='auto' *.undo_tablespace='UNDOTBS1' [oracle@monkey02 dbs]$ sqlplus / as sysdba SQL> create spfile from pfile; File created. [oracle@monkey02 ~]$ mkdir -p /u01/app/oracle/admin/monkeydb/adump [oracle@monkey02 ~]$ mkdir -p /u01/app/oracle/oradata/monkeydb [oracle@monkey02 ~]$ mkdir -p /u01/app/oracle/fast_recovery_area/monkeydb [oracle@monkey02 ~]$ sqlplus / as sysdba SQL> startup nomount; ORACLE instance started. Total System Global Area 1068937216 bytes Fixed Size 2260088 bytes Variable Size 432014216 bytes Database Buffers 629145600 bytes Redo Buffers 5517312 bytes [oracle@monkey02 ~]$ rman target sys/oracle@monkeymdb auxiliary sys/oracle@monkeysdb nocatalog Recovery Manager: Release 11.2.0.4.0 - Production on Sat Mar 31 14:25:26 2018 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: monkeydb (DBID=1072562510) using target database control file instead of recovery catalog connected to auxiliary database: monkeydb (not mounted) RMAN> duplicate target database for standby dorecover nofilenamecheck; [oracle@monkey02 ~]$ sqlplus / as sysdba SQL> alter database add standby logfile '/u01/app/oracle/oradata/monkeydb/standby01.log' size 50m; SQL> alter database add standby logfile '/u01/app/oracle/oradata/monkeydb/standby02.log' size 50m; SQL> alter database add standby logfile '/u01/app/oracle/oradata/monkeydb/standby03.log' size 50m; SQL> alter database add standby logfile '/u01/app/oracle/oradata/monkeydb/standby04.log' size 50m; SQL> alter database recover managed standby database disconnect from session using current logfile; [oracle@monkey01 ~]$ sqlplus / as sysdba SQL> alter system set log_archive_dest_state_2=enable scope=both; SQL> alter system switch logfile; [oracle@monkey02 ~]$ sqlplus / as sysdba SQL> alter database recover managed standby database cancel; SQL> alter database open; SQL> alter database recover managed standby database disconnect from session using current logfile; [oracle@monkey01 ~]$ sqlplus / as sysdba sql> set line 200 sql> col database_mode for a30 sql> col protection_mode for a30 sql> col recovery_mode for a30 sql> select dest_id , database_mode , recovery_mode , protection_mode from v$archive_dest_status where dest_id=2; dest_id database_mode recovery_mode protection_mode ---------- ------------------------------ ------------------------------ ------------------------------ 2 open_read-only managed real time apply maximum performance sql> col dest_name for a20 sql> col destination for a30 sql> col error for a50 sql> select dest_id,dest_name,status, destination, error from v$archive_dest where dest_id<=2; dest_id dest_name status destination error ---------- -------------------- --------------------------- ------------------------------ -------------------------------------------------- 1 log_archive_dest_1 valid db_recovery_file_dest 2 log_archive_dest_2 valid monkeysdb sql> col type for a20 sql> select dest_name,destination,status,type,archived_seq#,applied_seq# from v$archive_dest_status where dest_id<=2; dest_name destination status type archived_seq# applied_seq# -------------------- ------------------------------ --------------------------- -------------------- ------------- ------------ log_archive_dest_1 db_recovery_file_dest valid local 50 0 log_archive_dest_2 monkeysdb valid physical 50 49 sql> select thread# , sequence# , status from v$log; thread# sequence# status ---------- ---------- ------------------------------------------------ 1 49 inactive 1 50 inactive 1 51 current [oracle@monkey02 ~]$ sqlplus / as sysdba sql> set line 200 sql> col archived for a10 sql> select thread# , sequence# , archived , status from v$standby_log; thread# sequence# archived status ---------- ---------- ---------- ------------------------------ 1 51 yes active 1 0 no unassigned 0 0 yes unassigned 0 0 yes unassigned sql> select process , status , thread# , sequence# , block# , blocks from v$managed_standby where process != 'ARCH'; process status thread# sequence# block# blocks --------------------------- ------------------------------------ ---------- ---------- ---------- ---------- rfs idle 0 0 0 0 rfs idle 0 0 0 0 rfs idle 1 51 4381 1 mrp0 applying_log 1 51 4381 102400