今天用 AUL 恢复了一个定点的 Oracle804 的数据库,数据文件大小只有30M,使用免费版就足够了(不过数据文件只有30M,真怀疑定点是否值得花几千块钱买个 Oracle 企业版来用)。AUL 还是蛮好用的,使用起来非常简单。下面是恢复的记录:
1. 配置文件 yct.cfg
内容如下:
1 1 E:\huill_DATABASE\SYS1ORCL.ORA
1 16 E:\huill_DATABASE\HOSPITAL.ORA |
2. OPEN 数据文件
开始测试时,无法 open文件。多测试了几次,才发现这个数据库的数据块大小是2048,配置上对应的数据块大小,才算 open:
C:\Documents and Settings\IBM>e:
E:\>cd E:\huill_DATABASE
E:\huill_DATABASE>aul
Register Code: CXUL-LGFD-TOSJ-DPVL-IEUH AUL : AnySQL UnLoader(MyDUL) for Oracle 8/8i/9i/10g/11g, release 5.1.0
(C) Copyright Lou Fangxin 2005-2007 (for ITPub.net), all rights reserved.
AUL> open E:\huill_DATABASE\yct.cfg
* ts# fno rfn ver bsize blocks filename - ---- ---- ---- --- ----- ---------- ------------------------------- N 0 1 1 00 8192 344320 E:\huill_DATABASE\SYS1ORCL.ORA N 0 1 16 00 8192 6400 E:\huill_DATABASE\HOSPITAL.ORA AUL> set block_size 2048 Current BLOCK_SIZE is : 2048 AUL> open E:\huill_DATABASE\yct.cfg * ts# fno rfn ver bsize blocks filename - ---- ---- ---- --- ----- ---------- ------------------------------- Y 0 1 1 02 2048 344320 E:\huill_DATABASE\SYS1ORCL.ORA Y 4 5 5 02 2048 6400 E:\huill_DATABASE\HOSPITAL.ORA |
3. 生成恢复脚本
AUL> UNLOAD TABLE USER$;
2008-07-23 15:25:27 2008-07-23 15:25:27 AUL> UNLOAD TABLE OBJ$; 2008-07-23 15:25:31 2008-07-23 15:25:31 AUL> UNLOAD TABLE TAB$; 2008-07-23 15:25:35 2008-07-23 15:25:35 AUL> UNLOAD TABLE COL$; 2008-07-23 15:25:39 2008-07-23 15:25:39
AUL> desc hospital.ghk
Storage(OBJ#=2230 BJD=2230 TS=0 FILE=1 BLOCK=12445 CLUSTER=0)
No. SEQ INT Column Name Type --- --- --- ----------------------------- ---------------- 1 1 1 YYBM VARCHAR2(8) NOT NULL 2 2 2 GHDH VARCHAR2(15) NOT NULL 3 3 3 ZGBH VARCHAR2(10) NOT NULL 4 4 4 DWBM VARCHAR2(14) 5 5 5 FB NUMBER(1) 6 6 6 HB NUMBER(2) 7 7 7 KB VARCHAR2(3) NOT NULL 8 8 8 YSBM VARCHAR2(4) 9 9 9 GHRQ DATE NOT NULL 10 10 10 ZLF NUMBER(5,2) 11 11 11 GBF NUMBER(5,2) 12 12 12 YXQ NUMBER(2) 13 13 13 HZ NUMBER(1) 14 14 14 GHY VARCHAR2(4) 15 15 15 GHZT NUMBER(1) NOT NULL 16 16 16 ICKH VARCHAR2(18) 17 17 17 GHF NUMBER(5,2) 18 18 18 QH VARCHAR2(8) 19 19 19 SPBH NUMBER(15) 20 20 20 YLLB VARCHAR2(3) 21 21 21 YLFS VARCHAR2(3) 22 22 22 JBBM VARCHAR2(20) 23 23 23 GRZHZF NUMBER(6,2) 24 24 24 CSBZ NUMBER(1) 25 25 25 CSH NUMBER(10) 26 26 26 XM VARCHAR2(8) 27 27 27 XB VARCHAR2(2) 28 28 28 RYLB VARCHAR2(3) 29 29 29 SFZH VARCHAR2(18)
AUL> list table hospital
UNLOAD TABLE hospital.AA01 TO AA01.txt;
UNLOAD TABLE hospital.AA10 TO AA10.txt; UNLOAD TABLE hospital.AC30 TO AC30.txt; UNLOAD TABLE hospital.BCXX TO BCXX.txt; UNLOAD TABLE hospital.BFXX TO BFXX.txt; ...
UNLOAD TABLE hospital.ZK11 TO ZK11.txt;
UNLOAD TABLE hospital.ZLXXK TO ZLXXK.txt; UNLOAD TABLE hospital.ZLXXK_BD TO ZLXXK_BD.txt; UNLOAD TABLE hospital.ZYJS_PRINT TO ZYJS_PRINT.txt; |
4. 恢复数据
将在步骤(3)生成的脚本拷贝到文件 yct_recovery.sql 中:
UNLOAD TABLE hospital.AA01 TO AA01.txt;
UNLOAD TABLE hospital.AA10 TO AA10.txt; UNLOAD TABLE hospital.AC30 TO AC30.txt; UNLOAD TABLE hospital.BCXX TO BCXX.txt; UNLOAD TABLE hospital.BFXX TO BFXX.txt; ...
UNLOAD TABLE hospital.ZK11 TO ZK11.txt;
UNLOAD TABLE hospital.ZLXXK TO ZLXXK.txt; UNLOAD TABLE hospital.ZLXXK_BD TO ZLXXK_BD.txt; UNLOAD TABLE hospital.ZYJS_PRINT TO ZYJS_PRINT.txt; |
执行脚本 yct_recovery.sql,恢复数据:
AUL> @E:\huill_DATABASE\yct_recovery.sql
AUL> UNLOAD TABLE hospital.AA01 TO AA01.txt; 2008-07-23 15:30:49 Unload BJD=2180 FILE=5 BLOCK=2 CLUSTER=0 ... 2008-07-23 15:30:49 AUL> UNLOAD TABLE hospital.AA10 TO AA10.txt; 2008-07-23 15:30:49 Unload BJD=2182 FILE=5 BLOCK=222 CLUSTER=0 ... 2008-07-23 15:30:49
...
AUL> UNLOAD TABLE hospital.AC30 TO AC30.txt; 2008-07-23 15:30:49 Unload BJD=2184 FILE=5 BLOCK=302 CLUSTER=0 ... 2008-07-23 15:30:50 AUL> UNLOAD TABLE hospital.BCXX TO BCXX.txt; 2008-07-23 15:30:50 Unload BJD=2186 FILE=1 BLOCK=10535 CLUSTER=0 ... 2008-07-23 15:30:50 AUL> |
5. 将生成的文本数据 SQLLDR 到数据库中
创建表:
AUL> exit
E:\huill_DATABASE>sqlplus hospital/hospital@s9i
SQL*Plus: Release 9.2.0.1.0 - Production on 星期三 7月 23 21:03:11 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
连接到: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production
SQL> @E:\huill_DATABASE\syn\AA01_syntax.sql
表已创建。
SQL> @E:\huill_DATABASE\syn\AA10_syntax.sql
表已创建。
SQL> @E:\huill_DATABASE\syn\AC30_syntax.sql
表已创建。
...
SQL> @E:\huill_DATABASE\syn\ZYJS_PRINT_syntax.sql
表已创建。
|
导入数据:
SQL> exit
从Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production中断开
-- 这里的操作系统根目录必须得是生成的文本数据文件的目录,否则找不到对应的文件(看看控制文件中的内容就知道啦)
C:\Documents and Settings\IBM>sqlldr hospital/hospital@s9i control=E:\huill_DATABASE\ctl\AA01_sqlldr.ctl
SQL*Loader: Release 9.2.0.1.0 - Production on 星期三 7月 23 15:51:36 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL*Loader-500: 无法打开文件 (AA01.txt)
SQL*Loader-553: 未找到文件 SQL*Loader-509: 系统错误: 系统找不到指定的文件。 SQL*Loader-2026: 由于无法继续, 加载已中止。
C:\Documents and Settings\IBM>e:
E:\>
cd E:\huill_DATABASE
E:\huill_DATABASE>sqlldr userid=hospital/hospital@s9i control=E:\huill_DATABASE\AA01_sqlldr.ctl
SQL*Loader: Release 9.2.0.1.0 - Production on 星期三 7月 23 15:54:12 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
达到提交点,逻辑记录计数82
E:\huill_DATABASE>sqlldr userid=hospital/hospital@s9i control=E:\huill_DATABASE\AA10_sqlldr.ctl
SQL*Loader: Release 9.2.0.1.0 - Production on 星期三 7月 23 15:56:35 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
E:\huill_DATABASE>sqlldr userid=hospital/hospital@s9i control=E:\huill_DATABASE\FYFL_sqlldr.ctl
SQL*Loader: Release 9.2.0.1.0 - Production on 星期三 7月 23 15:57:59 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
达到提交点,逻辑记录计数5329
达到提交点,逻辑记录计数10658 达到提交点,逻辑记录计数15987 达到提交点,逻辑记录计数21316 达到提交点,逻辑记录计数26645 达到提交点,逻辑记录计数31974 达到提交点,逻辑记录计数32766
...
E:\huill_DATABASE>sqlldr userid=hospital/hospital@s9i control=E:\huill_DATABASE\ZYJS_PRINT_sqlldr.ctl
SQL*Loader: Release 9.2.0.1.0 - Production on 星期三 7月 23 16:04:38 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
E:\huill_DATABASE> |
恢复完毕。AUL 使用起来还是非常方便的,d.c.b.a 真牛。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27157/viewspace-441070/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/27157/viewspace-441070/