创建 删除 表空间


create tablespace test datafile ‘D:\ytzz\Oracle\oracledata\test.DBF‘ size 4500M autoextend on next 100M maxsize unlimited;

drop user test cascade;
/
create user test identified by test default tablespace test temporary tablespace temp;
/
GRANT DBA TO test WITH ADMIN OPTION
/
GRANT SELECT ANY DICTIONARY TO test WITH ADMIN OPTION
/
GRANT SELECT ANY SEQUENCE TO test WITH ADMIN OPTION
/
GRANT SELECT ANY TABLE TO test WITH ADMIN OPTION
/
GRANT SELECT ANY TRANSACTION TO test WITH ADMIN OPTION
/
GRANT UNLIMITED TABLESPACE TO test WITH ADMIN OPTION
/
GRANT CREATE SESSION,RESOURCE TO test WITH ADMIN OPTION
/
GRANT CREATE ANY VIEW to test
/


--删除表空间
drop tablespace test including contents and datafiles cascade constraint;

--修改密码
select password from dba_users where username=‘test‘;
alter user test identified by test;

--逻辑文件夹
select * from dba_directories;
create or replace directory DATABASE as ‘D:\YTZZ\copy‘;
drop directory DATABASE;

imp/impdp help=y 帮助文档

导入

impdp test/test directory=DATABASE dumpfile=test.DMP schemas=test full=y logfile=import.log

imp test/test file=D:\ytzz\copy\test.DMP TABLESPACES=test

第三步、SQL>shutdown normal

      提示:数据库已经关闭       已经卸载数据库       ORACLE 例程已经关闭

第四步、SQL>startup mount

第五步、SQL>alter database open;

shutdown immediate

startup 

删除表空间文件出错

第1 行出现错误: ORA-01157: 无法标识/锁定数据文件19 - 请参阅DBWR 跟踪文件

ORA-01110: 数据文件19: ‘‘‘‘C:\oracle\oradata\oradb\FYGL.ORA‘‘

这个提示文件部分根据每个人不同情况有点差别。

继续输入 第六步、SQL>alter database datafile 19 offline drop;    --- 19对应报错的数据文件19

第七步、重复使用第五第六步,直到出现“数据库已更改”的提示,然后如下图,

继续输入shutdown normal,startup mount就OK啦

相关推荐