最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊

重慶思莊oracle技術(shù)分享-如何從dump文件中提取元數(shù)據(jù)信息

2023-02-23 09:30 作者:D-Cycle  | 我要投稿

如何從dump文件中提取元數(shù)據(jù)信息?

1)通過sq生成sql方式


?

2)通過oracle提供的包


?

3)通過expdp和impdp



?

實(shí)現(xiàn)方法


?

1)通過sq生成sql方式


?

--11g使用(創(chuàng)建用戶)
select a.username,a.password_versions,a.account_status,a.lock_date,a.expiry_date,a.created,b.password,b.spare4,
? ?? ? case when a.password_versions in ('10G ') then
? ?? ?? ?? ?? ???'create user '||username||' identified by values '||''''||b.password||''''||' default tablespace '||default_tablespace||' temporary tablespace '||temporary_tablespace||';'
? ?? ?? ???when a.password_versions in ('10G 11G ','10G 11G 12C ') then
? ?? ?? ?? ?? ? 'create user '||b.name||' identified by values '||''''||b.spare4||';'||b.password||''' default tablespace '||a.default_tablespace||' temporary tablespace '||a.temporary_tablespace||';'
? ?? ?? ???else '' end as "create user"
from dba_users a,user$ b
where a.username=b.name
and a.user_id=b.user#;

--(創(chuàng)建角色)
select 'create role '||role||';' from dba_roles;
--角色權(quán)限
select 'grant '||GRANTED_ROLE||' to '||grantee||';' from dba_role_privs where
grantee in(select username from dba_users where trunc(created) <> to_date('2010/4/20','yyyy/mm/dd'));

select 'grant '||GRANTED_ROLE||' to '||grantee||';' from dba_role_privs where
grantee in(select username from dba_users where username not in
(select name
from system.logstdby$skip_support
where action=0) );

SQL> select 'grant '||GRANTED_ROLE||' to '||grantee||';' from dba_role_privs where grantee in(select username from dba_users where default_tablespace in(' TBS1 ' , ' TBS2 '));


--系統(tǒng)權(quán)限
select 'grant '||PRIVILEGE||' to '||grantee||';' from DBA_SYS_PRIVS where grantee in (select username from dba_users where username not in
(select name
from system.logstdby$skip_support
where action=0) );

--對象權(quán)限
select 'grant '||privilege||' on '||owner||'.'||table_name||' to '||grantee||';' from dba_tab_privs where owner='XXX' ;

目標(biāo)庫根據(jù)上述查詢結(jié)果進(jìn)行創(chuàng)建。


2)通過oracle提供的包
dbms_metadata.get_ddl
具體操作百度上面很多,方法也是一樣;

3)通過expdp和impdp
該方法,主要是通過從原庫中抽取自己想要的元數(shù)據(jù)信息,然后轉(zhuǎn)化成dmp文件內(nèi)容;
再利用impdp方式將dump中的內(nèi)容轉(zhuǎn)成文本方式,供用戶編輯調(diào)整使用
源庫:
create directory dump_xtts as '/backup/';
expdp \' sys/his as sysdba \' DIRECTORY=dump_xtts LOGFILE=user_exp.log dumpfile=user_exp.dmp INCLUDE=USER,ROLE,ROLE_GRANT,PROFILE full=y

目標(biāo)庫:
[oracle@ol7 backup]$ scp oracle@192.168.9.179:/backup/user_exp.* .
create directory dump_xtts as '/backup/';
impdp \' / as sysdba \' DIRECTORY=dump_xtts LOGFILE=user_exp.log dumpfile=user_exp.dmp INCLUDE=USER,ROLE,ROLE_GRANT,PROFILE sqlfile=text.sql

注意:上面這個(gè)就是將dump中的文件轉(zhuǎn)儲(chǔ)到/backup/下的text.sql中,將該sql拿出來就是提取的元數(shù)據(jù)腳本了;

?


重慶思莊oracle技術(shù)分享-如何從dump文件中提取元數(shù)據(jù)信息的評論 (共 條)

分享到微博請遵守國家法律
昌乐县| 尉犁县| 汽车| 平凉市| 资阳市| 安仁县| 寿宁县| 元江| 绥德县| 成安县| 兴文县| 清原| 双城市| 山东省| 鄂尔多斯市| 罗田县| 二手房| 黄山市| 德化县| 琼结县| 永嘉县| 石城县| 龙胜| 赤峰市| 丰县| 安吉县| 淮安市| 乐安县| 龙泉市| 万年县| 长治县| 南阳市| 宜兰市| 扎囊县| 汝城县| 清河县| 新晃| 金秀| 广汉市| 游戏| 荃湾区|