当前位置:网站首页>把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(3)—— 把数据库设置为归档模式
把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(3)—— 把数据库设置为归档模式
2022-06-24 22:55:00 【睿思达DBA_WGX】
把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(3)—— 把数据库设置为归档模式
一、查看数据库是否为归档模式
-- 节点1:非归档模式
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 15
Current log sequence 17
-- 节点2:非归档模式
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Current log sequence 2
二、打开归档模式
在 oracle rac 集群环境下,要设置一个节点为归档模式或非归档模式,必须关闭其他节点。
1、设置节点 rac1 为归档模式
(1)关闭节点2的实例
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
2、在节点 rac1 上执行如下操作
(1)正常停库,然后启动数据库到 mount 状态
-- 关闭实例
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
-- 启动数据库到 mount 状态
SQL> startup mount
ORACLE instance started.
Total System Global Area 638853120 bytes
Fixed Size 2255952 bytes
Variable Size 507511728 bytes
Database Buffers 121634816 bytes
Redo Buffers 7450624 bytes
Database mounted.
(2)使用 alter database 命令打开归档模式
SQL> alter database archivelog;
Database altered.
(3)关闭节点1的实例
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
3、在节点 rac2 上执行如下操作
(1)然后启动数据库到 mount 状态
-- 节点 rac2 处于关闭状态
-- 启动数据库到 mount 状态
SQL> startup mount
ORACLE instance started.
Total System Global Area 638853120 bytes
Fixed Size 2255952 bytes
Variable Size 465568688 bytes
Database Buffers 163577856 bytes
Redo Buffers 7450624 bytes
Database mounted.
(2)使用 alter database 命令打开归档模式
SQL> alter database archivelog;
Database altered.
(3)关闭节点1的实例归档模式
SQL> alter database archivelog;
Database altered.
4、打开数据库,查看归档状态
-- 节点1
SQL> startup
ORACLE instance started.
Total System Global Area 638853120 bytes
Fixed Size 2255952 bytes
Variable Size 507511728 bytes
Database Buffers 121634816 bytes
Redo Buffers 7450624 bytes
Database mounted.
Database opened.
-- 查看归档状态
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
-- 节点2
SQL> alter database open;
Database altered.
-- 查看归档状态
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 15
Next log sequence to archive 17
Current log sequence 17
三、设置归档的位置
当数据库处于归档模式时,进行日志切换时后台进程将自动生成归档日志。
1、查看归档进程数
SQL> show parameter LOG_ARCHIVE_MAX_PROCESSES
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_max_processes integer 4
2、查看归档文件
可知当前归档位置为:/u01/app/oracle/flash_recovery_area/HISDB/archivelog
SQL> select sequence#, name from v$archived_log;
SEQUENCE# NAME
--------------------------------------------------------------------------------
17
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_17_kbr52
8s8_.arc
18
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_18_kbr52
d2g_.arc
19
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_19_kbr52
g87_.arc
2
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_2_2_kbr52d
rp_.arc
20
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_20_kbr52
hdo_.arc
3、修改归档日志的位置为:+BAK/hisdb/archivelog
修改 log_archive_dest_1 参数指向定义的归档位置:
SQL> alter system set log_archive_dest_1 = 'location=+BAK' scope = both sid='*';
System altered.
-- 对比log_archive_dest 和log_archive_dest_1 设置归档的区别
-- alter system set log_archive_dest='+DATA'
-- alter system set log_archive_dest_1='location=+DATA'
4、查看归档文件
-- 切日志
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> select sequence#, name from v$archived_log;
SEQUENCE# NAME
--------------------------------------------------------------------------------
17
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_17_kbr52
8s8_.arc
18
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_18_kbr52
d2g_.arc
19
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_19_kbr52
g87_.arc
2
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_2_2_kbr52d
rp_.arc
20
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_20_kbr52
hdo_.arc
21
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_21.262.1107612429
22
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_22.263.1107612429
23
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_23.264.1107612429
24
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_24.265.1107612453
25
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_25.266.1107612453
26
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_26.267.1107612457
3
+BAK/hisdb/archivelog/2022_06_17/thread_2_seq_3.268.1107612601
4
+BAK/hisdb/archivelog/2022_06_17/thread_2_seq_4.269.1107612605
5
+BAK/hisdb/archivelog/2022_06_17/thread_2_seq_5.270.1107612607
14 rows selected.
边栏推荐
- 云原生数据库VS传统数据库
- 如何卸载cuda
- How to open a stock account? Is it safe to open a mobile account?
- 【Proteus仿真】Arduino UNO+继电器控制照明设备
- 数据库系统概论必背知识
- Resolution of cross reference in IDA
- Smartctl opens the device and encounters permission denied problem troubleshooting process record
- Are programmers from Huawei, Alibaba and other large manufacturers really easy to find?
- The ecosystem of the yuan universe
- 华为、阿里等大厂程序员真的好找对象吗?
猜你喜欢
Test / development programmers, 30, do you feel confused? And where to go
Chinese address and English address
Is it out of reach to enter Ali as a tester? Here may be the answer you want
Rod and Schwartz cooperated with ZhongGuanCun pan Lianyuan Institute to carry out 6G technology research and early verification
Intégration de la plate - forme de test continu open source de metersphere avec Alibaba Cloud Effect devops
qt打包exe文件,解决“无法定位程序输入点_ZdaPvj于动态链接库Qt5Cored.dll”
What is the reason for the disconnection of video playback due to the EHOME protocol access of easycvr platform?
文件系统 -- 磁盘基础知识和FAT32文件系统详细介绍
记一次beego通过go get命令后找不到bee.exe的坑
The ecosystem of the yuan universe
随机推荐
DDD概念复杂难懂,实际落地如何设计代码实现模型?
Lizuofan, co-founder of nonconvex: Taking quantification as his lifelong career
Squid 代理服务器之 ACL 访问控制
|How to analyze bugs? Professional summary and analysis
Use of hashcat
疫情防控,居家办公,网上授课之心得 | 社区征文
Application of TSDB in civil aircraft industry
同花顺是正规平台吗?同花顺开户安全吗
Intranet learning notes (6)
LINQ query (3)
Investigation on key threats of cloud computing applications in 2022
Do you know your ABC
中文地址与英文地址
Sumati GameFi生态纵览,神奇世界中的元素设计
Basic layout -qhboxlayout class, qvboxlayout class, qgridlayout class
The role of software security testing, how to find a software security testing company to issue a report?
探索C语言程序奥秘——C语言程序编译与预处理
Constant current circuit composed of 2 NPN triodes
中信证券手机开户是靠谱的吗?安全吗
业务与技术双向结合构建银行数据安全管理体系