Saturday, September 02, 2006

Drop a Target Database using RMAN

Starting with Oracle10g Release 1, Oracle provides a method
to completely drop a database with one simple statement. This
method makes use of the DROP DATABASE command in RMAN.

NOTE: Although this should be obvious from the title of the article,
the following will completely drop the target database including
all datafiles, controlfiles, redo log files, SPFILE, and if you
want, all backups and archived redo log files associated with the database. Consider yourself warned.

The DROP DATABASE Command

NOTE: Before the target database can be dropped, it must be mounted in EXCLUSIVE mode with RESTRICTED SESSION enabled.

Before dropping the database, let's take a look at the complete syntax for the RMAN DROP DATABASE command:
DROP DATABASE;
DROP DATABASE NOPROMPT;
DROP DATABASE INCLUDING BACKUPS;
DROP DATABASE INCLUDING BACKUPS NOPROMPT;
When "NOPROMPT" is specified, RMAN will not prompt for confirmation
before deleting the database. The default for RMAN is to prompt
for confirmation.

Restrictions and Usage Notes

  • This command can only be run from RMAN.
  • You must be connected to the target database from RMAN while
    the database is mounted in EXCLUSIVE mode with RESTRICTED SESSION enabled.

  • When using the "DROP DATABASE" command, RMAN drops the target
    database including the following files at the operating system level:

    • Datafiles
    • Online Redo Log Files
    • Controlfiles
    • SPFILE (if it exists)
  • When including the "INCLUDING BACKUPS" clause, RMAN will delete the
    files listed above as well as the following files at the operating system level:

    • Archive Redo Logs
    • Backup pieces generated by RMAN for the target database
  • When using the "DROP DATABASE" command with RMAN connected
    to a recovery catalog, RMAN will unregister the target database.

  • The "DROP DATABASE" command does not delete the following files:

    • init.ora (text version of the Oracle initialization file)
    • password file
  • If the operating system is Windows NT/2000, then it does not delete
    the Windows NT service for the target database instance.

DROP DATABASE EXAMPLE

In this article, I will be dropping a database named orcl. The orcl database is in archivelog mode and has several backups included in the Flash Recovery Area. I want to drop the target database along with all backup files.

$ sqlplus "/ as sysdba"

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount exclusive
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 100664912 bytes
Database Buffers 180355072 bytes
Redo Buffers 2973696 bytes
Database mounted.

SQL> alter system enable restricted session;

System altered.

SQL> exit

$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Aug 7 17:33:25 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ORCL (DBID=1123903688, not open)

RMAN> drop database including backups;

database name is "ORCL" and DBID is 1123903688

Do you really want to drop all backups and the database (enter YES or NO)? YES

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
51 31 1 1 AVAILABLE DISK /u02/flash_recovery_area/ORCL/backupset/2006_08_07/o1_mf_annnn_TAG20060807T164635_2fh9of4s_.bkp
52 32 1 1 AVAILABLE DISK /u02/flash_recovery_area/ORCL/backupset/2006_08_07/o1_mf_nnndf_TAG20060807T164638_2fh9ogvf_.bkp
53 33 1 1 AVAILABLE DISK /u02/flash_recovery_area/ORCL/backupset/2006_08_07/o1_mf_ncsnf_TAG20060807T164638_2fh9vzo0_.bkp
54 34 1 1 AVAILABLE DISK /u02/flash_recovery_area/ORCL/backupset/2006_08_07/o1_mf_annnn_TAG20060807T165009_2fh9w2lm_.bkp
deleted backup piece
backup piece handle=/u02/flash_recovery_area/ORCL/backupset/2006_08_07/o1_mf_annnn_TAG20060807T164635_2fh9of4s_.bkp recid=51 stamp=597861997
deleted backup piece
backup piece handle=/u02/flash_recovery_area/ORCL/backupset/2006_08_07/o1_mf_nnndf_TAG20060807T164638_2fh9ogvf_.bkp recid=52 stamp=597861998
deleted backup piece
backup piece handle=/u02/flash_recovery_area/ORCL/backupset/2006_08_07/o1_mf_ncsnf_TAG20060807T164638_2fh9vzo0_.bkp recid=53 stamp=597862207
deleted backup piece
backup piece handle=/u02/flash_recovery_area/ORCL/backupset/2006_08_07/o1_mf_annnn_TAG20060807T165009_2fh9w2lm_.bkp recid=54 stamp=597862210
Deleted 4 objects


released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
specification does not match any archive log in the recovery catalog

database name is "ORCL" and DBID is 1123903688
database dropped

50 Comments:

Blogger Sudip said...

Hi Jeffrey,
The blog is very nice...Please upload more topics with example...

2:41 PM  
Blogger Sudip said...

Jeffrey you are the master in oracle database....but i have only 3 years of experience in oracle dba field. Please can you guide me to learn more in Oracle? If I ask you some doubts then can you answer my questions???

Thanks a Lot in Advance...

2:44 PM  
Blogger ramesh said...

Hi Jerry,

Really I need to thank you and I want to learn from you lot of things. I have started my oracle carrier for the past 2years. could you please posted the notes like RAMN incremental and cumulative backups with some examples.and also I want to learn STANDBY and DATAGUARD can you help me. This will be helpful for my improving oracle carrier and knowledge.

Thanks a lot and advance.

Ramesh.

9:19 AM  
Blogger en said...

Your article at
http://www.idevelopment.info/data/Oracle/DBA_tips/Database_Administration/DBA_16.shtml
was very helpful. Keep it up. Thanks.

10:34 PM  
Blogger pbsl said...

you have a nice site. thanks for sharing this valuable resources. keep it up. anyway, various kinds of ebooks are available here

http://feboook.blogspot.com

8:14 PM  
Blogger 孤單 said...

別人短處,掩蓋幾分;別人過失,包容幾分。 ..................................................

3:04 AM  
Blogger 睡衣 said...

^^ 謝謝你的分享,祝你生活永遠多彩多姿!........................................

1:19 AM  
Blogger ORACLE-DBA's get in to unvers said...

Hi jeffery,I admire you a lot you a really good in oracle dba.I am O.C.A certified having three years experience and I would like to be a member of your blog and share my knowledge.

9:00 AM  
Blogger 疲累 said...

裸體寫真全裸美女圖片色情訊息黃色圖片自拍裸體圖片sex裸露圖片18限85cc a片台灣色情網站免費色情圖一夜激情聊天情色聊天室限制級爆乳女優作愛巨乳學院性愛情慾陰脣一夜情下體網愛聊天鹹濕做愛自拍成人圖庫成人影城性關係視訊情人性影片觀賞裸照淫美成人論壇av寫真自拍裸女貼圖av圖情色性愛貼圖成人vcdsexy辣妹視訊聊天色情視訊淫婦台灣情色論壇丁字褲貼圖免費a片影片淫蕩女人live show男女做愛火辣妹妹激情網愛聊天美女裸照免費色情網站

3:24 AM  
Blogger 香蕉哥哥 said...

笑口常開~~天天開心........................................

4:04 AM  
Blogger v佩怡佩怡 said...

KK777一夜激情聊天live show成人自拍貼圖自慰少婦自拍裸體圖片台灣色情成人網站情人視訊網情色留言板視訊美女免費視訊聊天室限制級極度震撼情色論壇色情特區自拍裸女貼圖潮吹性影片觀賞小穴情色片a圖片sex story性愛影片美女做愛成人色情網站性愛圖片成人情色貼圖全裸寫真集圖片走光圖女生陰毛自慰影片色情av1007成人色情聊天室女生自慰裸體照成人影音聊天台灣色情網站色情片打手槍情色天堂成人視訊聊天免費情色網站av網超性感辣妹激突成人論壇情色視訊聊天鹹濕成人網站av成人論壇免費美女視訊

1:51 AM  
Blogger 童紫勳 said...

人生最大的榮耀,不是永遠不敗,而是屢仆屢戰........................................

5:38 AM  
Blogger 李妍妮 said...

教育的目的,不在應該思考什麼,而是教吾人怎樣思考......................................................

8:45 PM  
Blogger 子珠 said...

^^ 謝謝你的分享,祝你生活永遠多彩多姿!........................................

5:12 PM  
Blogger 茂恒 said...

sex女,ut,貼影,av,高潮,女優,做愛,手機成人影片,色遊戲,成人動漫,百分百貼圖區,85cc影片,成人影音,av色情影片,A片線上,a片,sex,777,三級線上看,美女的照片,視訊做愛,78論壇,打飛機,免費視訊,成人影院,辣妹視訊,視訊聊天,影片網,kiss911,a片,交友,聊天,做愛,免費影片,性交,線上成人,網路色情,聊天,美女自慰,免費a分享,免費短片,裸照,一夜情,女優,85cc成人片,美女寫真,偷拍a,情人視訊聊天室

9:42 PM  
Blogger 上心 said...

cool blog,期待更新........................................

7:34 PM  
Blogger 詩婷 said...

找一個懂妳的人也期許自己做一個人懂別人的人......................................................

7:34 PM  
Blogger 詩婷v said...

我來湊熱鬧的~~^^ 要平安快樂哦.........................

7:57 PM  
Blogger 許淑福 said...

君子立恆志,小人恆立志。.............................................

8:17 PM  
Blogger AlexanderLotts0 said...

discovery影片下載成人論壇 一夜情天空交友 av969影片 xxx383 援交聊天室sex520 視訊交友icase avshow 免費視訊聊天 s383情色大網咖免費 a片 視訊美女happystore 免費影片試看 台北視訊 高雄視訊34c 辣妹視訊無名影片下載 視訊主播脫衣秀gogo2sex 免費視訊情人辣妹 咆哮小老鼠視訊聊天室 免費影片 影片-章子怡 168888運動網 080性感沙灘3 免費av成人圖片素人自拍18 成人 淫美人論壇 dudu嘟嘟-免費視訊 0401免費視訊聊天室 日本免費視訊聊天 18成人視訊網 咆哮小老鼠影片分享區 視訊辣妹080 18美女視訊 gogo2sex免費視訊 0401成人交友 一夜情視訊 網愛聊天室meet520 視訊美女linnet 台灣kiss情色網 麗的娛樂網 成人影城-情色影片 8dgo視訊聊天網 桃園辣妹視訊 視訊妹 a片線上觀賞sex888免費看影片論壇 玩美女人,視訊 免費視訊34c辣妹微風論壇 日本視訊小魔女自拍 AA片免費試看 免費線上歐美A片觀看 辣妺視訊 免費聊天室d760 淫淫美女視訊交友 色遊戲王國

5:44 PM  
Blogger 文佩齊華 said...

you‘re so smart!............................................................

8:37 AM  
Blogger 俊翔 said...

聰明的人喜歡猜心 雖然每次都猜對了卻失去了自己的心..................................................

8:44 PM  
Blogger SadeRa盈君iford0412 said...

pleasure to find such a good artical! please keep update!!........................................

4:50 AM  
Blogger 芸茂 said...

向著星球長驅直進的人,反比踟躕在峽路上的人,更容易達到目的。..................................................................

11:07 PM  
Blogger 俊偉 said...

第一次睇你blog,鐘意! .................................................................

3:25 PM  
Blogger 王邦鈺 said...

要照顧身體歐~保重......................................................................

7:27 PM  
Blogger 韻枝 said...

良言一句三冬暖,惡語傷人六月寒。....................................................................

1:27 AM  
Blogger 張瑋劭 said...

所有的資產,在不被諒解時,都成了負債....................................................................

1:27 AM  
Blogger 靜宸靜宸 said...

成熟,就是有能力適應生活中的模糊。.................................................................

7:40 PM  
Blogger 芸茂芸茂 said...

It takes all kinds to make a world.............................................................

12:23 AM  
Blogger 婷珊 said...

No garden without its weeds.............................................................

10:44 AM  
Blogger 姿柯瑩柯dgdd憶曾g智曾 said...

來幫忙拼人氣~Go Go Go..................................................................

10:45 AM  
Blogger 吳婷婷 said...

命運,就是自己行為的結果。..................................................

6:06 PM  
Blogger 佩璇佩璇 said...

脾氣與嘴巴不好,就算心地再好,也不算好人~~~..................................................

2:27 AM  
Blogger 楊儀卉 said...

上班好累哦,看看部落格轉換心情~~~先謝謝啦!!..................................................................

6:07 PM  
Blogger 彥安 said...

「仁慈」二個字,就能讓冬天三個月都溫暖。..................................................

12:47 AM  
Blogger 琬安琬安 said...

你的努力我們都看見了--支持你............................................................

7:06 PM  
Blogger 謝文新李怡君 said...

每天都是新的心情~~希望都是好心情!!!!..................................................................

4:47 PM  
Blogger 徐禎緯 said...

良好的開端,已是成功的一半。..................................................

6:16 PM  
Blogger 肇戴佩 said...

Readiness is all.............................................................

9:06 PM  
Blogger 佳陳容 said...

人生中最好的禮物就是屬於自己的一部份............................................................

7:26 PM  
Blogger 凱v胡倫 said...

拒絕冒險和成長的人,終將被生命的潮流陶汰。..................................................

7:24 AM  
Blogger 宇緯陳陳宇緯陳陳 said...

More haste, less speed..................................................................

12:02 AM  
Blogger 4464 said...

喜歡自己的另一層意義是「接納自己」。..................................................

12:03 AM  
Blogger 易強青易強青易強青 said...

凡事三思而行,跑得太快是會滑倒的。..................................................

1:09 PM  
Blogger 張王雅竹欣虹 said...

在你一無所有的時候 是誰在陪伴你 他便是你最重要的人......................................................................

6:05 PM  
Blogger 至馬馬馬馬玄馬馬馬馬 said...

生命如夏花洵爛;死如秋葉之靜美。........................................ ........................

8:56 PM  
Blogger 劉陳佳生怡陳佳生修 said...

說「吃虧就是便宜的人」,多半不是吃虧的人。......................................................................

2:22 AM  
Blogger 灏群 said...

真有內容的部落格~推推!.................................[/url]...............

6:14 PM  
Blogger dil said...

500 plus jobs in Google.visit hyderabadiindians.blogspot .com

1:27 AM  

Post a Comment

<< Home