解决pciss_spc导入提示表空间不存在以及扩展失败的问题

 1 select NAME FROM USER$ ORDER BY NAME  ;
 2 CREATE USER **** IDENTIFIED BY **** ;
 3 GRANT DBA TO **** ;
 4 SELECT * FROM dba_directories ;
 5 SELECT * FROM USER$ U WHERE U.NAME=UPPER('****') ;
 6 SELECT * FROM Dba_Tablespaces ;
 7 SELECT * FROM Dba_Data_Files ;
 8  CREATE DIRECTORY PUMP_DIR_**** AS 'D:\orcl_data\****';
 9 grant read,write on directory PUMP_DIR_**** to ****;
10 DROP DIRECTORY dpdata ;
11 DROP USER **** CASCADE ;    
12 CREATE USER **** IDENTIFIED BY ****  DEFAULT TABLESPACE ****_spc TEMPORARY TABLESPACE temp PROFILE Default;
13 GRANT DBA TO **** ;
14 
15 SELECT * FROM user_objects o WHERE o.object_name=**** ; 
16  
17      
18 CREATE TABLESPACE ****_spc 
19 LOGGING
20 DATAFILE 'F:\APP\TY\ORADATA\ORCL\****_spc.DBF'
21  SIZE 6144m ; 
22  AUTOEXTEND ON 
23  NEXT 50m MAXSIZE 12803072 
24  EXTENT MANAGEMENT LOCAL ;
25 
26 
27 
28 create tablespace ****_spc 
29 datafile 'F:\APP\TY\ORADATA\ORCL\****_spc1.DBF'
30 size 5000M 
31 autoextend on next 50M maxsize 7144m;
32 删除表空间
33 ALTER TABLESPACE  ****_spc ADD DATAFILE 'F:\APP\TY\ORADATA\ORCL\****_spc1.DBF' SIZE 3000M AUTOEXTEND ON  NEXT 50M MAXSIZE UNLIMITED;
34 
35 
36 drop tablespace DEMOSPACE including contents and DATAFILES
37 
38 ALTER SYSTEM KILL SESSION '63,33';
39 
40 ALTER SYSTEM KILL SESSION '132,3765';
41 
42 
43 ALTER DATABASE 
44     DATAFILE 'F:\APP\TY\ORADATA\ORCL\****_spc.DBF' AUTOEXTEND 
45     ON NEXT 500M MAXSIZE UNLIMITED ;
46 
47 
48 SELECT T.TABLESPACE_NAME,D.FILE_NAME,
49 D.AUTOEXTENSIBLE,D.BYTES,D.MAXBYTES,D.STATUS
50 FROM DBA_TABLESPACES T,DBA_DATA_FILES D
51 WHERE T.TABLESPACE_NAME =D.TABLESPACE_NAME
52 ORDER BY TABLESPACE_NAME,FILE_NAME;
53 
54 SELECT  *  FROM (
55 SELECT UPPER(F.TABLESPACE_NAME) "表空间名",
56 D.TOT_GROOTTE_MB "表空间大小(M)",
57 D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空间(M)",
58 TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,2),'990.99') "使用比",
59 F.TOTAL_BYTES "空闲空间(M)",
60 F.MAX_BYTES "最大块(M)"
61 FROM (SELECT TABLESPACE_NAME,
62 ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,
63 ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES
64 FROM SYS.DBA_FREE_SPACE
65 GROUP BY TABLESPACE_NAME) F,
66 (SELECT DD.TABLESPACE_NAME,
67 ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB
68 FROM SYS.DBA_DATA_FILES DD
69 GROUP BY DD.TABLESPACE_NAME) D
70 WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
71 ORDER BY 4 DESC
72 ) a WHERE "表空间名"='****_SPC';
73 
74 
75 
76 -----------------------------------------
77 
78 
79 
80 
81 
82 
83 imp ^^^^/****@xxxx file=D:\orcl_data\****\****20160729.DMP log=D:\orcl_data\****\****20160729.log fromuser=**** touser=**** buffer=10240000 
84 
85 impdp ****/*****@**** directory=PUMP_DIR_**** dumpfile=****20160729.DMP schemas=****86 REMAP_TABLESPACE=****_SPC:USERS ;
87 
88 impdp ****/****@**** directory=PUMP_DIR_**** dumpfile=****20160729.DMP REMAP_SCHEMA=****:****  REMAP_TABLESPACE=****_SPC:USERS  ;
89 
90 
91 
92 impdp ****/****@**** directory=PUMP_DIR_**** dumpfile=****20160729.DMP   REMAP_TABLESPACE=****_SPC:USERS full=y
93 impdp ****/****@**** directory=PUMP_DIR_**** dumpfile=****20160729.DMP REMAP_SCHEMA=****:****  ;
94 REMAP_SCHEMA=****:**** ;

 

posted @ 2016-11-07 12:12  linbo.yang  阅读(438)  评论(0编辑  收藏  举报