自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Oracle數(shù)據(jù)庫exp imp以用戶來導(dǎo)出的實(shí)例

數(shù)據(jù)庫 Oracle
我們今天主要介紹的是Oracle數(shù)據(jù)庫exp imp按相關(guān)的用戶來導(dǎo)出導(dǎo)入相關(guān)實(shí)例,希望你在瀏覽完相關(guān)的實(shí)例會(huì)對(duì)其實(shí)際的操作步驟有所了解。

以下的文章主要介紹Oracle數(shù)據(jù)庫exp imp按相關(guān)的用戶來導(dǎo)出導(dǎo)入相關(guān)實(shí)例,第一步我們要從一臺(tái)windows服務(wù)器 A 上導(dǎo)出關(guān)于 Test1 這個(gè)用戶的所有對(duì)象,然后導(dǎo)入到linux服務(wù)器 B 上的 Test2用戶。(已知Test1密碼為Test1passwd 或者用system用戶導(dǎo)出也行)

2.B機(jī)器上Test2用戶不存在,或Test2用戶已經(jīng)存在 兩種情況(用戶存在相對(duì)比較復(fù)雜)

如果Test2用戶已經(jīng)存在(數(shù)據(jù)沒用,可以刪除),級(jí)聯(lián)刪除用戶及所有對(duì)象(有可能遇到有人正在連接,刪除不掉的情況 方法參照下文),重新創(chuàng)建賬號(hào)并賦權(quán)。

3.賦予適當(dāng)?shù)臋?quán)限

操作步驟:

1.從 A 上導(dǎo)出數(shù)據(jù)文件到指定目錄(目錄名稱自己定義,只要自己能找到就行,和用戶名沒有關(guān)系)

  1. sqlplus /nolog   
  2. conn / as sysdba   
  3. exp Test1/Test1passwd owner=Test1 file=D:\files\Test1.dmp   

 

2.在A機(jī)器上查看用戶默認(rèn)表空間,以便導(dǎo)入時(shí)創(chuàng)建一樣的表空間

  1. SQL> select username,default_tablespace from dba_users where username ='TEST1';   
  2. USERNAME DEFAULT_TABLESPACE   
  3. TEST1 CMIS   

 

3.查看用戶使用的表空間

  1. SQL> select DISTINCT owner ,tablespace_name from dba_extents where owner like 'TEST1';   
  2. OWNER TABLESPACE_NAME   
  3. TEST1 XSL   
  4. TEST1 CMIS   

 

4.查看表空間對(duì)應(yīng)的數(shù)據(jù)文件,以便在B上創(chuàng)建大小合適的數(shù)據(jù)文件。

  1. SQL> select file_name,tablespace_name from dba_data_files where tablespace_name in ('CMIS','XSL');   
  2. FILE_NAME BYTES TABLESPACE   
  3. D:ORACLEPRODUCT10.2.0ORADATACMISDBCMIS 8728346624 CMIS   
  4. D:ORACLEPRODUCT10.2.0ORADATACMISDBCMIS01.ORA 8204058624 CMIS   
  5. D:ORACLEPRODUCT10.2.0ORADATACMISDBCMIS02.ORA 4194304000 CMIS   
  6. D:ORACLEPRODUCT10.2.0ORADATACMISDBCMIS03.ORA 4194304000 CMIS   
  7. D:ORACLEPRODUCT10.2.0ORADATACMISDBCMIS04.ORA 4194304000 CMIS   
  8. D:ORACLEPRODUCT10.2.0ORADATACMISDBCMIS05.ORA 4194304000 CMIS   
  9. D:ORACLEPRODUCT10.2.0ORADATACMISDBCMIS06.ORA 4194304000 CMIS   
  10. D:ORACLEPRODUCT10.2.0ORADATACMISDBXSL.ORA 4194304000 XSL   
  11. D:ORACLEPRODUCT10.2.0ORADATACMISDBXSL01.ORA 4194304000 XSL   
  12. D:ORACLEPRODUCT10.2.0ORADATACMISDBXSL02.ORA 4194304000 XSL   
  13.  

 

 

5.檢查B機(jī)器的表空間,看是否存在CMIS,XSL

 

  1. select name from v$tablespace where name in ('XSL','CMIS');  

查找不到,說明沒有這個(gè)兩個(gè)表空間,需要?jiǎng)?chuàng)建。

6.要導(dǎo)入數(shù)據(jù)的server沒有xsl,cmis表空間。創(chuàng)建

 

  1. create tablespace xsl logging datafile 
    '/opt/oracle/product/10.2.0/oradata/xsl.dbf' 
    size 15000M extent management local;   
  2. create tablespace cmis logging datafile 
    '/opt/oracle/product/10.2.0/oradata/cmis.dbf' size 37000M extent management local;   

 

7.在服務(wù)器B上查找用戶是否已經(jīng)存在

 

  1. SQL> select username from dba_users where username='TEST2';  

接下來分為兩種情況,如果不存在那么按照 [一] 方法,如果存在按照 [二]

創(chuàng)建用戶

 

  1. create user Test2 identified by Test2passwd default tablespace cmis temporary tablespace temp profile default;  

如果用戶存在

  1. drop user Test2 cascade;  

(刪除用戶及其擁有的所有對(duì)象)

此時(shí)如果這個(gè)用戶在連接,drop會(huì)出錯(cuò),必須先殺掉用戶的session,然后再drop user

 

  1. SELECT 'alter system kill session '''
    ||SID||','||SERIAL||''' immediate;
    ' FROM V$SESSION WHERE 
    USERNAME='TEST2';  

(如果用戶正在連接,構(gòu)建命令并殺掉)

(上面的語句是構(gòu)建出殺掉Test2用戶session的語句)比如:

 

  1. 'ALTERSYSTEMKILLSESSION'''||SID||','||SERIAL||'''IMMEDIATE;'  
  2. alter system kill session '129,3570' immediate;   
  3. alter system kill session '131,2' immediate;   
  4. alter system kill session '133,572' immediate;   
  5. alter system kill session '135,1456' immediate;   
  6. alter system kill session '136,487' immediate;   
  7. alter system kill session '138,302' immediate;   
  8. alter system kill session '139,366' immediate;   

 

再?gòu)?fù)制這些語句,粘貼到sqlplus中執(zhí)行,來殺掉Test2的session。

  1. create user Test2 identified by Test2passwd default 
    tablespace cmis temporary tablespace temp profile default; 

(創(chuàng)建用戶)

  1. grant connect,resource to Test2;  

(授權(quán))

8.把文件從A機(jī)器上拷貝到B機(jī)器上。假如拷貝過來放到tmp目錄下/tmp/Test1.dmp

9.最后在A機(jī)器上按用戶導(dǎo)入數(shù)據(jù)

一定注意執(zhí)行imp時(shí)要退出sqlplus,在linux的shell下執(zhí)行imp

 

  1. [oracle@test2 ~]$ imp Test2/Test2passwd fromuser 
    =
    Test1 touser =test2 file=D:\xsldb.DMP log =app/oracle/file/log/DEV_PMODOC.log;  

以上的相關(guān)內(nèi)容就是對(duì)Oracle數(shù)據(jù)庫exp imp按用戶導(dǎo)出導(dǎo)入實(shí)例的介紹,望你能有所收獲。

【編輯推薦】

  1. 發(fā)揮Oracle數(shù)據(jù)庫數(shù)據(jù)管理功能的3個(gè)方案
  2. Oracle 11g中最具有獨(dú)特點(diǎn)的5大特點(diǎn)
  3. Oracle DRCP與PHP實(shí)際應(yīng)用的區(qū)別
  4. Oracle In-Memory Undo的特性討論
  5. Oracle數(shù)據(jù)庫,超強(qiáng)!
責(zé)任編輯:佚名 來源: 博客園
相關(guān)推薦

2011-08-16 13:17:29

2010-04-19 17:39:04

Oracle導(dǎo)入

2010-10-26 11:39:51

Oracle EXPIMP備份

2009-06-05 11:55:00

數(shù)據(jù)庫用戶管理數(shù)據(jù)導(dǎo)入導(dǎo)出

2011-05-19 13:25:14

Oracle數(shù)據(jù)庫

2010-04-22 16:16:35

Oracle數(shù)據(jù)庫

2010-04-22 17:06:24

Oracle數(shù)據(jù)庫

2011-04-15 10:37:53

Oracle導(dǎo)入導(dǎo)出語法

2011-03-29 10:47:49

ORACLE數(shù)據(jù)庫

2009-11-19 17:25:12

Oracle數(shù)據(jù)庫物理

2010-04-14 15:45:49

Oracle 數(shù)據(jù)庫

2010-04-02 13:46:30

Oracle數(shù)據(jù)導(dǎo)出

2011-05-26 15:20:46

Oracle數(shù)據(jù)庫導(dǎo)出

2010-04-06 11:30:09

Oracle 數(shù)據(jù)庫

2009-11-16 11:31:54

Oracle數(shù)據(jù)導(dǎo)入

2010-04-06 16:50:07

Oracle數(shù)據(jù)庫

2011-04-13 09:03:58

Oracle數(shù)據(jù)庫導(dǎo)入導(dǎo)出

2011-08-16 18:55:10

Oracle數(shù)據(jù)庫構(gòu)造過程

2011-05-26 15:27:08

Oracle數(shù)據(jù)庫

2015-07-23 17:02:55

oracle創(chuàng)建數(shù)據(jù)庫
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)