altersystemsetdb_create_file_dest='/oradata/data/standby'scope=both;Systemaltered.SQL>showparameterdb_createNAMETYPEVALUE-------------" />

亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

轉:Oracle:刪除表空間

系統 1974 0

原文: http://space.itpub.net/40239/viewspace-365948

?

OMF和非OMF管理的數據文件在DROP TABLESPACE時是否會自動刪除,做了測試:

SQL> alter system set db_create_file_dest='/oradata/data/standby' scope=both;

System altered.

?

SQL> show parameter db_create

NAME???????????????????????????????? TYPE??????? VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest????????????????? string????? /oradata/data/standby
db_create_online_log_dest_1????????? string
db_create_online_log_dest_2????????? string
db_create_online_log_dest_3????????? string
db_create_online_log_dest_4????????? string
db_create_online_log_dest_5????????? string


SQL> create tablespace t3 datafile size 10m;

Tablespace created.

SQL> select * from v$tablespace;

?????? TS# NAME?????????????????????????? INC
---------- ------------------------------ ---
???????? 0 SYSTEM???????????????????????? YES
???????? 1 UNDOTBS1?????????????????????? YES
???????? 2 TEMP?????????????????????????? YES
???????? 3 INDX?????????????????????????? YES
???????? 4 USR??????????????????????????? YES
???????? 5 KONG?????????????????????????? YES
???????? 6 TEST?????????????????????????? YES
???????? 9 T1???????????????????????????? YES
???????? 8 LOGMNRTS?????????????????????? YES
??????? 10 T2???????????????????????????? YES
??????? 11 T3???????????????????????????? YES

11 rows selected.

SQL> select name from v$datafile??where ts# = 11;

NAME
--------------------------------------------------------------------------------
/oradata/data/standby/o1_mf_t3_464smo7s_.dbf

?

SQL> create table t100 (id int) tablespace t3;

Table created.

SQL> drop tablespace t3;
drop tablespace t3
*
ERROR at line 1:
ORA-01549: tablespace not empty, use INCLUDING CONTENTS option


SQL> drop tablespace t3 including contents?;

Tablespace dropped.

SQL> !ls -l /oradata/data/standby/o1_mf_t3_464smo7s_.dbf
ls: 0653-341 The file /oradata/data/standby/o1_mf_t3_464smo7s_.dbf does not exist.

看到在DROP TABLESPACE時,就算沒有加上 and datafiles是選項, ORACLE 也會自動刪除數據文件;

?

?

SQL> create tablespace t3 datafile '/oradata/data/standby/data/t3.dbf' size 10m;

Tablespace created.

SQL> create table t100 (a int) tablespace t3;

Table created.

SQL> drop tablespace t3 ;
drop tablespace t3
*
ERROR at line 1:
ORA-01549: tablespace not empty, use INCLUDING CONTENTS option


SQL> drop tablespace t3? including contents;

Tablespace dropped.

SQL> !ls -l /oradata/data/standby/data/t3.dbf
-rw-r-----?? 1 oracle?? dba??????? 10493952 Jun 25 23:42 /oradata/data/standby/data/t3.dbf

沒有加上and datafiles參數時,oracle不會自動刪除datafiles。

?

SQL> create tablespace t3 datafile '/oradata/data/standby/data/t4.dbf' size 10m;

Tablespace created.

SQL> create table t100 (a int) tablespace t3;

Table created.

SQL> drop tablespace t3? including contents and datafiles;

Tablespace dropped.

SQL> !ls -l /oradata/data/standby/data/t4.dbf
ls: 0653-341 The file /oradata/data/standby/data/t4.dbf does not exist.

加上and datafiles參數時,oracle會自動刪除datafiles。

?

?

SQL> alter system set db_create_file_dest='' scope=both;

System altered.

SQL> create tablespace t3 datafile '/oradata/data/standby/data/t4.dbf' size 10m;

Tablespace created.

SQL> create table t100 (a int) tablespace t3;

Table created.

SQL> drop tablespace t3? including contents and datafiles;

Tablespace dropped.

SQL> !ls -l /oradata/data/standby/data/t4.dbf
ls: 0653-341 The file /oradata/data/standby/data/t4.dbf does not exist.

SQL>

?

===============================================

SQL code:


--刪除空的表空間,但是不包含物理文件
drop tablespace tablespace_name;


--刪除非空表空間,但是不包含物理文件
drop tablespace tablespace_name including contents;


--刪除空表空間,包含物理文件
drop tablespace tablespace_name including datafiles;


--刪除非空表空間,包含物理文件
drop tablespace tablespace_name including contents and datafiles;


--如果其他表空間中的表有外鍵等約束關聯到了本表空間中的表的字段,就要加上CASCADE CONSTRAINTS
drop tablespace tablespace_name including contents and datafiles CASCADE CONSTRAINTS;

?

轉:Oracle:刪除表空間


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 亚洲一区二区三区久久 | 午夜毛片在线观看 | 久久精品re | 久久精品国产精品亚洲毛片 | 老司机观看精品一区二区 | 91精品国产99久久 | a男人天堂 | 99热久久这里只精品国产9 | 亚洲黄色在线观看视频 | wwe亚洲第一站 | 久久青草91线频免费观看 | 麻豆精品永久免费视频 | 神马不卡伦影视 | 成人影院高清在线观看免费网站 | 国产福利影院 | 久草免费在线观看 | 久久夜夜视频 | 亚洲精品丝袜在线一区波多野结衣 | 精品久久久久久久久中文字幕 | 欧美毛片网站 | 99在线国产| 久久久久久久国产免费看 | 亚洲精品乱码久久久久久 | 久久精品国产影库免费看 | 久操视频在线观看 | 精品一区二区三区在线观看 | 91色蝌蚪 | 99在线视频网站 | 久久在线视频免费观看 | 亚洲精品国产美女在线观看 | www.色午夜| 久久亚洲国产精品五月天婷 | 成人中文字幕一区二区三区 | 九九99九九在线精品视频 | 黄页免费观看1 | 成人看免费一级毛片 | 成人黄色网址 | 久久久精品免费 | 最新99国产成人精品视频免费 | 一本一道波多野结衣一区二区 | 欧美观看一级毛片 |