来源:Oracle认证 发布时间:2012-11-12 Oracle认证视频 评论
此时数据库的活动全部记录在以下目录中的文件中
[oracle@dbtest ~]$ ls -l dbcapture/
total 16
drwxr-xr-x 2 oracle oinstall 4096 Sep 26 10:18 cap
drwxr-xr-x 3 oracle oinstall 4096 Sep 26 09:31 capfiles
四、闪回到SP1时刻
由于只有一个11G的数据库环境,因此重放也是在这个数据库中进行的。此时
需要闪回到以前创建表的时候,以便观察。
SQL> CONN / AS SYSDBA
Connected.
SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP MOUNT
ORACLE instance started.
Total System Global Area 343154688 bytes
Fixed Size 1336428 bytes
Variable Size 260049812 bytes
Database Buffers 75497472 bytes
Redo Buffers 6270976 bytes
Database mounted.
SQL> FLASHBACK DATABASE TO RESTORE POINT SP1;
Flashback complete.
SQL> ALTER DATABASE OPEN RESETLOGS;
Database altered.
SQL> CONN TEST/test
Connected.
SQL> select tname from tab;
no rows selected
SQL> create or replace directory test as '/home/oracle/dbcapture';
Directory created.
SQL> grant all on directory test to test;
Grant succeeded.
五、准备重放进程
首先进行预处理
SQL> EXEC DBMS_WORKLOAD_REPLAY.PROCESS_CAPTURE('TEST');
PL/SQL procedure successfully completed.
SQL> EXEC DBMS_WORKLOAD_REPLAY.INITIALIZE_REPLAY('REPLAY1','TEST');
PL/SQL procedure successfully completed.
SQL> EXEC DBMS_WORKLOAD_REPLAY.PREPARE_REPLAY;
PL/SQL procedure successfully completed.
以ORACLE用户登录到操作系统中,启动重放客户端
[oracle@dbtest ~]$ wrc userid=system password=oracle replaydir=/home/oracle/dbcapture/
Workload Replay Client: Release 11.2.0.1.0 - Production on Sun Sep 26 10:47:24 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Wait for the replay to start (10:47:24)
此时可以看到等待重放。
重新回到SQLPLUS下:
六、开始重放
SQL> EXEC DBMS_WORKLOAD_REPLAY.START_REPLAY;
PL/SQL procedure successfully completed.
SQL> SELECT ID,NAME,DBNAME,DBVERSION,DIRECTORY,STATUS FROM DBA_WORKLOAD_REPLAYS;
ID NAME DBNAME DBVERSION DIRECTORY STATUS
---------- ---------- ---------- ---------- ---------- --------------------
1 REPLAY1 TEST11G 11.2.0.1.0 TEST IN PROGRESS
此时可以看到重放客户端会出现 Replay started
[oracle@dbtest ~]$ wrc userid=system password=oracle replaydir=/home/oracle/dbcapture/
Workload Replay Client: Release 11.2.0.1.0 - Production on Sun Sep 26 10:47:24 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Wait for the replay to start (10:47:24)
Replay started (10:49:01)
ALERT文件中会出现:
Sun Sep 26 10:49:01 2010
DBMS_WORKLOAD_REPLAY.START_REPLAY(): Starting database replay at 09/26/2010 10:49:00
重放完成后,DBA_WORKLOAD_REPLAYS的STATUS列会标记为COMPLETED.
SQL> SELECT ID,NAME,DBNAME,DBVERSION,DIRECTORY,STATUS FROM DBA_WORKLOAD_REPLAYS;
ID NAME DBNAME DBVERSION DIRECTORY STATUS
---------- ---------- ---------- ---------- ---------- --------------------
1 REPLAY1 TEST11G 11.2.0.1.0 TEST COMPLETED
重放客户端会自动退出
[oracle@dbtest ~]$ wrc userid=system password=oracle replaydir=/home/oracle/dbcapture/
Workload Replay Client: Release 11.2.0.1.0 - Production on Sun Sep 26 10:47:24 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Wait for the replay to start (10:47:24)
Replay started (10:49:01)
Replay finished (11:35:30)
[oracle@dbtest ~]$
10000条记录,竟然重放了1个小时,可能和虚拟机有关系。
ALERT日志文件记录如下内容:
Sun Sep 26 11:34:07 2010
DBMS_WORKLOAD_REPLAY: Database replay ran to completion at 09/26/2010 11:34:07
Sun Sep 26 11:34:24 2010
DM00 started with pid=34, OS id=5583, job SYS.SYS_EXPORT_TABLE_01
Sun Sep 26 11:34:30 2010
DW00 started with pid=35, OS id=5585, wid=1, job SYS.SYS_EXPORT_TABLE_01
怀疑数据是通过数据泵导入的。
SQL> CONN TEST/test
Connected.
SQL> SELECT COUNT(1) FROM T;
COUNT(1)
----------
10000
① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;
② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。