环境梳理
原始库(主库):
ip:192.168.1.210
db_name:orcl
sid:orcl
db_unique_name:orcl
hostname;Nagiostest
[oracle@Nagiostest ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.210 Nagiostest
192.168.1.211 OEL6
创建的物理备库(备库):
ip:192.168.1.211
db_name:orcl
sid:orcl2
db_unique_name:orcl2
hostname;OEL6
[oracle@OEL6 ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.211 OEL6
192.168.1.210 Nagiostest
一:配置主库:
1.打开数据库的强制写功能
select force_logging from v$database;
alter database force logging;
SQL> select force_logging from v$database;
FOR
---
YES
2.创建口令文件
orapwd file=$ORACLE_HOME/dbs/orapworcl password=yuanlei force=y
3.创建standby logfile group
如果数据库工作在最大保护或者最大可用模式必须要配standby logfile
首先确认一下自身环境下的日志组个日志成员个数+1创建
SQL> select GROUP#,STATUS,MEMBER from v$logfile;
GROUP# STATUS MEMBER
---------- ------- ---------------------------------------------
3 /u01/app/oracle/oradata/orcl/redo03.log
2 /u01/app/oracle/oradata/orcl/redo02.log
1 /u01/app/oracle/oradata/orcl/redo01.log
SQL>
alter database add standby logfile group 4('/u01/app/oracle/oradata/orcl/redo0401.log') size 50M;
alter database add standby logfile group 5('/u01/app/oracle/oradata/orcl/redo0501.log') size 50M;
alter database add standby logfile group 6('/u01/app/oracle/oradata/orcl/redo0601.log') size 50M;
alter database add standby logfile group 7('/u01/app/oracle/oradata/orcl/redo0701.log') size 50M;
4.验证standby logfile group
SQL> select GROUP#,STATUS,MEMBER from v$logfile;
GROUP# STATUS MEMBER
---------- ------- ---------------------------------------------
3 /u01/app/oracle/oradata/orcl/redo03.log
2 /u01/app/oracle/oradata/orcl/redo02.log
1 /u01/app/oracle/oradata/orcl/redo01.log
4 /u01/app/oracle/oradata/orcl/redo0401.log
5 /u01/app/oracle/oradata/orcl/redo0501.log
6 /u01/app/oracle/oradata/orcl/redo0601.log
7 /u01/app/oracle/oradata/orcl/redo0701.log
SQL> select group#,thread#,sequence#,archived,status from v$standby_log;
GROUP# THREAD# SEQUENCE# ARC STATUS
---------- ---------- ---------- --- ----------
4 0 0 YES UNASSIGNED
5 0 0 YES UNASSIGNED
6 0 0 YES UNASSIGNED
7 0 0 YES UNASSIGNED
5.配置归档
shutdown immediate
startup mount
alter database archivelog;
alter system set log_archive_dest_1='location=/u01/archivelog'
alter database open;
-- 之前已经开启过归档,信息如下
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/archivelog
Oldest online log sequence 87
Next log sequence to archive 89
Current log sequence 89
6.创建pfile参数文件,用于复制数据库时,在备库上启动辅助实例
SQL> create pfile from spfile;
File created.
[oracle@Nagiostest dbs]$ pwd
/u01/app/oracle/product/11.2/dbs
[oracle@Nagiostest dbs]$ ls initorcl.ora
initorcl.ora
7.配置主库的参数文件
主角色参数配置:
alter system set db_unique_name='orcl' scope=spfile;
alter system set log_archive_config='dg_config=(orcl,orcl2)'scope=spfile;
alter system set log_archive_dest_1='location=/u01/archivelog valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=orcl' scope=spfile;
alter system set log_archive_dest_2='service=orcl2 ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=orcl2' scope=spfile;
alter system set control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl' scope=spfile;
alter system set log_archive_dest_state_1=enable scope=spfile;
alter system set log_archive_dest_state_2=enable scope=spfile;
alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
alter system set log_archive_max_processes=10 scope=spfile;
alter system set remote_login_passwordfile=exclusive scope=spfile;
alter system set fal_server=orcl2 scope=spfile;
alter system set fal_client=orcl scope=spfile;
alter system set db_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orcl' scope=spfile;
alter system set log_file_name_convert='/u01/app/oracle/oradata/orcl/','/u01/app/oracle/oradata/orcl/' scope=spfile;
alter system set standby_file_management=auto scope=spfile;
重启数据库:
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string orcl
SQL> startup force
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2213896 bytes
Variable Size 331352056 bytes
Database Buffers 75497472 bytes
Redo Buffers 4308992 bytes
Database mounted.
Database opened.
SQL>
8.主库网络配置
创建监听:
[oracle@Nagiostest ~]$ cd /u01/app/oracle/product/11.2/network/admin/
[oracle@Nagiostest admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.2)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Nagiostest)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
[oracle@Nagiostest admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.210)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORCL2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.211)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl2)
)
)
二:配置备库
1.配置物理背库数据库的参数文件
从主库复制参数文件
scp 主库的pfile参数文件,并更名为 initorcl2.ora
[oracle@OEL6 dbs]$ ls
cntrlorcl2.dbf hc_DBUA0.dat hc_orcl2.dat hc_orcl.dat init.ora lkORCL lkORCL2
[oracle@OEL6 dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
[oracle@OEL6 dbs]$ scp 192.168.1.210:/u01/app/oracle/product/11.2/dbs/initorcl.ora ./initorcl2.ora
[email protected]'s password:
initorcl.ora 100% 1459 1.4KB/s 00:00
[oracle@OEL6 dbs]$ ls
cntrlorcl2.dbf hc_DBUA0.dat hc_orcl2.dat hc_orcl.dat init.ora initorcl2.ora lkORCL lkORCL2
创建归档和其它目录:
[oracle@OEL6 dbs]$ mkdir -p /u01/archivelog2
[oracle@OEL6 dbs]$ mkdir -p /u01/app/oracle/admin/orcl/{a,b,c,dp,u}dump
[oracle@OEL6 dbs]$ mkdir -p /u01/app/oracle/oradata/orcl
创建spfile
export ORACLE_SID=orcl2 这里如果是已经设置好的(.bash_profile),就没必要设置
sqlplus / as sysdba
startup nomount pfile=?/dbs/initorcl2.ora
启用spfile
SQL> startup nomount pfile=?/dbs/initorcl2.ora
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2213896 bytes
Variable Size 268437496 bytes
Database Buffers 138412032 bytes
Redo Buffers 4308992 bytes
SQL> create spfile from pfile;
File created.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2213896 bytes
Variable Size 268437496 bytes
Database Buffers 138412032 bytes
Redo Buffers 4308992 bytes
SQL>
配置备库orcl2数据库的参数文件
alter system set db_unique_name='orcl2' scope=spfile;
alter system set log_archive_config='dg_config=(orcl,orcl2)' scope=spfile;
alter system set log_archive_dest_1='location=/u01/archivelog2 valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=orcl2' scope=spfile;
alter system set log_archive_dest_2='service=orcl ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=orcl' scope=spfile;
alter system set control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl' scope=spfile;
alter system set log_archive_dest_state_1=enable scope=spfile;
alter system set log_archive_dest_state_2=enable scope=spfile;
alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
alter system set log_archive_max_processes=10 scope=spfile;
alter system set remote_login_passwordfile=exclusive scope=spfile;
alter system set fal_server=orcl scope=spfile;
alter system set fal_client=orcl2 scope=spfile;
alter system set db_file_name_convert='/u01/app/oracle/oradata/orcl/','/u01/app/oracle/oradata/orcl/' scope=spfile;
alter system set log_file_name_convert='/u01/app/oracle/oradata/orcl/','/u01/app/oracle/oradata/orcl/' scope=spfile;
alter system set standby_file_management=auto scope=spfile;
关闭数据库使参数下次启动生效
shutdown immediate;
2.为standby数据库创建一个password
从源库拷贝将口令文件拷贝过来,修改名字
-- orapwd file=$ORACLE_HOME/dbs/orapworcl2 password=yuanlei force=y ----密码与主库的密码完全一样(不建议这样)
重启动备库到nomount
startup nomount;
3.网络配置
创建启动监听:
在监听器里进行静态注册:
[oracle@OEL6 admin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/network/admin
[oracle@OEL6 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl2)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl2)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = OEL6)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
[oracle@OEL6 admin]$ cat tnsnames.ora
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.210)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORCL2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl2)
)
)
启动监听
lsnrctl start
在两端数据库检查是否联通
tnsping orcl
tnsping orcl2
确保网络畅通
三、在主库上用rman进行全备份,并生成备库所用的控制文件和其它数据文件
在主库和备库上创建相同的备份目录(主库的本次的备份要完全拷贝的备库的相同目录下)注意要备份standby控制文件
mkdir -p /u01/rmanbak
[oracle@Nagiostest rmanbak]$ rman target /
run {
allocate channel c0 type disk;
allocate channel c1 type disk;
allocate channel c2 type disk;
backup database filesperset 10 format='/u01/rmanbak/%d_%s_%T.dbf'
include current controlfile for standby
plus archivelog format='/u01/rmanbak/%d_%s_%T.arc';
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
release channel c0;
release channel c1;
release channel c2;
}
完成备份之后,在主库上将备份集完全复制到备库
[oracle@Nagiostest rmanbak]$ scp /u01/rmanbak/* 192.168.1.211:/u01/rmanbak
[email protected]'s password:
ORCL_81_20140820.arc 100% 3140KB 3.1MB/s 00:00
ORCL_82_20140820.arc 100% 2033KB 2.0MB/s 00:00
ORCL_83_20140820.arc 100% 672KB 671.5KB/s 00:00
ORCL_84_20140820.arc 100% 502KB 501.5KB/s 00:00
ORCL_85_20140820.dbf 100% 613MB 16.6MB/s 00:37
ORCL_86_20140820.dbf 100% 385MB 16.0MB/s 00:24
ORCL_87_20140820.dbf 100% 74MB 14.9MB/s 00:05
ORCL_88_20140820.dbf 100% 10MB 9.9MB/s 00:00
ORCL_89_20140820.arc 100% 43KB 42.5KB/s 00:00
在主库使用rman连接主库和备库,进行文件传输
[oracle@Nagiostest rmanbak]$ rman target / auxiliary sys/yuanlei@orcl2
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Aug 20 16:03:43 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1382226447)
connected to auxiliary database: ORCL (not mounted)
RMAN> duplicate target database for standby dorecover nofilenamecheck;
.
.
.
复制的过程
.
.
.
复制最后出现了Error
starting media recovery
Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 08/20/2014 16:05:50
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of archived log for thread 1 with sequence 112 and starting SCN of 1185239 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 111 and starting SCN of 1185229 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 110 and starting SCN of 1185209 found to restore
RMAN> quit
这个不影响,在下面下面备库执行应用redo后会自动补全
此时备库已经启动到mount状态
在备库orcl2上操作应用日志如下:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
Database altered.
之后会自动应rman复制所提示的没有传递到目标数据库的归档日志文件
此时在备库查看查看alert日志,缺失的归档日志已经应用,并且在备库的归档目录下,已经接收到主库传递过来的对应归档日志
[oracle@OEL6 trace]$ tail -30f alert_orcl2.log
Managed Standby Recovery not using Real Time Apply
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Log /u01/archivelog2/1_109_854445713.arc
Media Recovery Log /u01/archivelog2/1_110_854445713.arc
Media Recovery Log /u01/archivelog2/1_111_854445713.arc
Media Recovery Log /u01/archivelog2/1_112_854445713.arc
Media Recovery Log /u01/archivelog2/1_113_854445713.arc
Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT
Media Recovery Log /u01/archivelog2/1_114_854445713.arc
Media Recovery Log /u01/archivelog2/1_115_854445713.arc
Media Recovery Log /u01/archivelog2/1_116_854445713.arc
Media Recovery Log /u01/archivelog2/1_117_854445713.arc
Media Recovery Log /u01/archivelog2/1_118_854445713.arc
Media Recovery Waiting for thread 1 sequence 119 (in transit)
归档会被应用
四:测试
在 主库orcl 上做些修改,然后切换日志
SQL> create table test as select * from dual;
Table created.
SQL> select * from test;
D
-
X
SQL> alter system switch logfile;
System altered.
在主库做日志切换的时候,可以在备库查看日志的增加变化情况
在orcl2 备库上查看是否已经同步数据
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Database altered.
SQL> alter database open read only;
Database altered.
SQL> select * from test;
D
-
X
ok 已经开始同步
在备库上查看日志:
SQL> SELECT NAME, CREATOR, SEQUENCE#, APPLIED, COMPLETION_TIME FROM V$ARCHIVED_LOG order by SEQUENCE#;
NAME CREATOR SEQUENCE# APPLIED COMPLETION_TIME
---------------------------------------- ------- ---------- --------- -------------------
/u01/archivelog2/1_109_854445713.arc ARCH 109 YES 2014-08-21 00:59:38
/u01/archivelog2/1_110_854445713.arc ARCH 110 YES 2014-08-21 00:59:39
/u01/archivelog2/1_111_854445713.arc ARCH 111 YES 2014-08-21 00:59:38
/u01/archivelog2/1_112_854445713.arc ARCH 112 YES 2014-08-21 00:59:38
/u01/archivelog2/1_113_854445713.arc ARCH 113 YES 2014-08-21 00:59:41
/u01/archivelog2/1_114_854445713.arc ARCH 114 YES 2014-08-21 00:59:49
/u01/archivelog2/1_115_854445713.arc ARCH 115 YES 2014-08-21 00:59:48
/u01/archivelog2/1_116_854445713.arc ARCH 116 YES 2014-08-21 00:59:46
/u01/archivelog2/1_117_854445713.arc ARCH 117 YES 2014-08-21 00:59:40
/u01/archivelog2/1_118_854445713.arc ARCH 118 YES 2014-08-21 00:59:49
/u01/archivelog2/1_119_854445713.arc ARCH 119 YES 2014-08-21 01:01:50
NAME CREATOR SEQUENCE# APPLIED COMPLETION_TIME
---------------------------------------- ------- ---------- --------- -------------------
/u01/archivelog2/1_120_854445713.arc ARCH 120 YES 2014-08-21 01:03:14
/u01/archivelog2/1_121_854445713.arc ARCH 121 YES 2014-08-21 01:10:00
/u01/archivelog2/1_122_854445713.arc ARCH 122 YES 2014-08-21 01:10:44
/u01/archivelog2/1_123_854445713.arc ARCH 123 YES 2014-08-21 01:15:38
15 rows selected.
----------------------------------------------------------
To start apply services on a physical standby database, ensure the physical standby database is started and mounted and then start Redo Apply using the SQL ALTER DATABASE RECOVER MANAGED STANDBY DATABASE statement.
You can specify that Redo Apply runs as a foreground session or as a background process, and enable it with real-time apply.
To start Redo Apply in the foreground, issue the following SQL statement:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE;
If you start a foreground session, control is not returned to the command prompt until recovery is canceled by another session.
To start Redo Apply in the background, include the DISCONNECT keyword on the SQL statement. For example:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
This statement starts a detached server process and immediately returns control to the user. While the managed recovery process is performing recovery in the background, the foreground process that issued the RECOVER statement can continue performing other tasks. This does not disconnect the current SQL session.
To start real-time apply, include the USING CURRENT LOGFILE clause on the SQL statement. For example:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;
To stop Redo Apply, issue the following SQL statement:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
----------------------------------------------------------
在备库中启动redo apply
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
----------------------------------------------------------
至此,physical standby db 配置完成
1.查看主库scn
SQL> select name,checkpoint_change# from v$datafile;
NAME CHECKPOINT_CHANGE#
--------------------------------------------- ------------------
/u01/app/oracle/oradata/orcl/system01.dbf 1191503
/u01/app/oracle/oradata/orcl/sysaux01.dbf 1191503
/u01/app/oracle/oradata/orcl/undotbs01.dbf 1191503
/u01/app/oracle/oradata/orcl/users01.dbf 1191503
/u01/app/oracle/oradata/orcl/example01.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl01.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl02.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl03.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl04.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl05.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl06.dbf 1191503
NAME CHECKPOINT_CHANGE#
--------------------------------------------- ------------------
/u01/app/oracle/oradata/orcl/tbs_yl07.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl08.dbf 1191503
/u01/app/oracle/oradata/orcl/rcatalog.dbf 1191503
14 rows selected.
SQL> select name,checkpoint_change# from v$datafile_header;
NAME CHECKPOINT_CHANGE#
--------------------------------------------- ------------------
/u01/app/oracle/oradata/orcl/system01.dbf 1191503
/u01/app/oracle/oradata/orcl/sysaux01.dbf 1191503
/u01/app/oracle/oradata/orcl/undotbs01.dbf 1191503
/u01/app/oracle/oradata/orcl/users01.dbf 1191503
/u01/app/oracle/oradata/orcl/example01.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl01.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl02.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl03.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl04.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl05.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl06.dbf 1191503
NAME CHECKPOINT_CHANGE#
--------------------------------------------- ------------------
/u01/app/oracle/oradata/orcl/tbs_yl07.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl08.dbf 1191503
/u01/app/oracle/oradata/orcl/rcatalog.dbf 1191503
14 rows selected.
SQL>
2.查看备库scn
SQL> select name,checkpoint_change# from v$datafile;
NAME CHECKPOINT_CHANGE#
--------------------------------------------- ------------------
/u01/app/oracle/oradata/orcl/system01.dbf 1191503
/u01/app/oracle/oradata/orcl/sysaux01.dbf 1191503
/u01/app/oracle/oradata/orcl/undotbs01.dbf 1191503
/u01/app/oracle/oradata/orcl/users01.dbf 1191503
/u01/app/oracle/oradata/orcl/example01.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl01.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl02.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl03.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl04.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl05.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl06.dbf 1191503
NAME CHECKPOINT_CHANGE#
--------------------------------------------- ------------------
/u01/app/oracle/oradata/orcl/tbs_yl07.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl08.dbf 1191503
/u01/app/oracle/oradata/orcl/rcatalog.dbf 1191503
14 rows selected.
SQL> select name,checkpoint_change# from v$datafile_header;
NAME CHECKPOINT_CHANGE#
--------------------------------------------- ------------------
/u01/app/oracle/oradata/orcl/system01.dbf 1191503
/u01/app/oracle/oradata/orcl/sysaux01.dbf 1191503
/u01/app/oracle/oradata/orcl/undotbs01.dbf 1191503
/u01/app/oracle/oradata/orcl/users01.dbf 1191503
/u01/app/oracle/oradata/orcl/example01.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl01.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl02.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl03.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl04.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl05.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl06.dbf 1191503
NAME CHECKPOINT_CHANGE#
--------------------------------------------- ------------------
/u01/app/oracle/oradata/orcl/tbs_yl07.dbf 1191503
/u01/app/oracle/oradata/orcl/tbs_yl08.dbf 1191503
/u01/app/oracle/oradata/orcl/rcatalog.dbf 1191503
14 rows selected.
可以看到完全一样