oracle批量生成索引,批量导出创建索引的脚本
SQL> desc oracle.testNameNull?Type----------------------------------------------------------------- -------- ----------------------...
SQL> desc oracle.test
Name Null? Type
----------------------------------------------------------------- -------- --------------------------------------------
ID NUMBER
NAME VARCHAR2(32)
SQL> select * from oracle.test;
ID NAME
---------- --------------------------------
1 Test
2 TEST_UPDATE
SQL> create index test_idx1 on oracle.test(id);
Index created.
# expdp / content=metadata_only tables=oracle.test include=table/index directory=REFRESH_DUMP_DIR dumpfile=indx.dmp
Export: Release 10.2.0.3.0 - 64bit Production on Monday, 03 March, 2014 1:19:16
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Starting "ORACLE"."SYS_EXPORT_TABLE_01": /******** content=metadata_only tables=oracle.test include=table/********index directory=REFRESH_DUMP_DIR dumpfile=indx.dmp
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
ORA-39166: Object TEST was not found.
Master table "ORACLE"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for ORACLE.SYS_EXPORT_TABLE_01 is:
/data/oracle/sprrnyp1/SM_ENV_REFRESH/sprrnyp1/data/indx.dmp
Job "ORACLE"."SYS_EXPORT_TABLE_01" completed with 1 error(s) at 01:19:21
SQL> drop index test_idx1;
Index dropped.
#/home/oracle >
# impdp / directory=REFRESH_DUMP_DIR dumpfile=indx.dmp full=y
Import: Release 10.2.0.3.0 - 64bit Production on Monday, 03 March, 2014 1:21:44
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Master table "ORACLE"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "ORACLE"."SYS_IMPORT_FULL_01": /******** directory=REFRESH_DUMP_DIR dumpfile=indx.dmp full=y
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Job "ORACLE"."SYS_IMPORT_FULL_01" successfully completed at 01:21:47
SQL> select owner,object_name ,object_type,created from dba_objects where object_name='TEST_IDX1';
OWNER OBJECT_NAME OBJECT_TYPE CREATED
------------------------------ ------------------------------ ------------------- -----------------
ORACLE TEST_IDX1 INDEX 20140303 01:21:47

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)