五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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ù)信息的評論 (共 條)

分享到微博請遵守國家法律
文登市| 日照市| 新丰县| 石渠县| 收藏| 太原市| 沁源县| 普兰县| 罗江县| 浦北县| 聊城市| 逊克县| 星子县| 斗六市| 太原市| 颍上县| 山阳县| 丁青县| 乐山市| 怀集县| 浪卡子县| 岳阳县| 伊吾县| 岚皋县| 花垣县| 星座| 辉县市| 囊谦县| 马鞍山市| 石渠县| 青海省| 勃利县| 江陵县| 中卫市| 乌拉特前旗| 鄄城县| 曲靖市| 道真| 永和县| 北安市| 科技|