- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
2#
发表于 2012-6-11 20:19:30
如何备份oracle 的统计信息, 可以通过 dbms_stats包将 statistics export到表中,之后将该统计表 在exp为dmp 文件,以逻辑备份。
ODM DATA:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
SQL> create user maclean identified by oracle;
User created.
SQL> grant dba to maclean;
Grant succeeded.
SQL> conn maclean/maclean
Connected.
SQL> exec dbms_stats.create_stat_table('MACLEAN','STATS');
PL/SQL procedure successfully completed.
在MACLEAN SCHEMA 下建立名为 STATS的表存放相关统计信息
SQL> exec dbms_stats.export_schema_stats('MACLEAN','STATS','MACLEAN1');
PL/SQL procedure successfully completed.
在导出 MACLEAN 模式下的统计信息到STATS表, statid为MACLEAN1 作为统计信息的标示符
SQL> Exec dbms_stats.export_dictionary_stats('STATS','MACLEAN1_DIC','MACLEAN');
PL/SQL procedure successfully completed.
导出字典统计信息 到 MACLEAN.STATS表, statid为MACLEAN1_DIC 作为统计信息的标示符
用exp 导出该stats表 到dmp文件
[oracle@vrh8 ~]$ exp maclean/maclean tables=stats file=stats.dmp
Export: Release 10.2.0.5.0 - Production on Mon Jun 11 08:18:28 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and UTF8 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table STATS 59734 rows exported
Export terminated successfully without warnings. |
|