1.导出主键
SELECT 'ALTER TABLE ' || B.TABLE_NAME || ' ADD CONSTRAINT ' ||
B.CONSTRAINT_NAME || ' PRIMARY KEY (' ||
(SELECT TO_CHAR(WMSYS.WM_CONCAT(A.COLUMN_NAME))
FROM USER_CONS_COLUMNS A
WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME) || ');'
FROM USER_CONSTRAINTS B
WHERE B.CONSTRAINT_TYPE = 'P' and b.owner='要导出的用户';
2.导出索引
SELECT 'CREATE ' || DECODE(B.INDEX_TYPE, 'NORMAL', '', B.INDEX_TYPE) ||
DECODE(B.UNIQUENESS, 'NONUNIQUE', '', B.UNIQUENESS) || ' INDEX ' ||
B.INDEX_NAME || ' ON ' || B.TABLE_NAME || ' (' ||
(SELECT TO_CHAR(WMSYS.WM_CONCAT(A.COLUMN_NAME))
FROM USER_IND_COLUMNS A
WHERE A.INDEX_NAME = B.INDEX_NAME) || ');'
FROM USER_INDEXES B WHERE b.table_owner='要导出的用户名';
3.导出触发器
3-1.使用plsql 选择Tools-Export user objects,如图下:
3-2.选择类型为 Type =TRIGGER的类型,执行导出,如图下:
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...