一、dbca不能delete數據庫
裝了實例,但是dbca後不能選中delete a database選項,如下圖
解決方法,在/etc/oratab文件裏添加實例的信息:
[root@custest ~]# cat /etc/oratab |grep -v"#"
custest:/u02/oracle/product/10.2.0/db:N
格式:
SID:ORACLE_HOME:Y|N
做一記錄。
二、/etc/oratab文件
[root@custest ~]# more /etc/oratab
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database ConfigurationAssistant when creating
# a database.
# A colon, ':', is used as the fieldterminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the systemidentifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should ,"Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID arenot allowed.
#
#
custest:/u02/oracle/product/10.2.0/db:N
/etc/oratab 由root.sh 腳本創建,在用DBCA 創建實例時也會更新這個文件。
當$ORACLE_SID:$ORACLE_HOME:<N|Y> 設置爲Y時,允許實例自啓動,當設置爲N時,則不允許自啓動。這個文件裏的配置僅僅起一個開關的作用,其並不會具體的執行啓動和關閉,具體的操作由$ORACLE_HOME/bin/dbstart和dbshut腳本來實現。這2個腳本在執行時會檢查/etc/oratab文件裏的配置,爲Y時才能繼續執行。
所以配置數據庫自啓動和關閉的步驟如下:
(1) 配置/etc/oratab
(2) 修改$ORACLE_HOME/bin/dbstart和dbshut,並將其添加到/etc/rc(.local)文件中。
這裏是使用oracle 自帶的dbstart 和dbshut腳本,如果使用自己寫的腳本來啓動或關閉DB 就不需要關心這個文件的設置了。
三、DB 開機自啓動示例
1 修改/etc/oratab的值爲Y
gg1:/u01/app/oracle/product/11.2.0.3/db_1/bin>ll/etc/oratab
-rw-rw-r-- 1 oracle oinstall 722 Jan 3020:36/etc/oratab
gg1:/u01/app/oracle/product/11.2.0.3/db_1/bin>cat/etc/oratab
#
gg1:/u01/app/oracle/product/11.2.0.3/db_1:Y
2 修改dbstart的ORACLE_HOME_LISTNER,使其指向$ORACLE_HOME:
# First argument is used to bring up OracleNetListener
ORACLE_HOME_LISTNER=$ORACLE_HOME
3 用root用戶在rc.local裏添加如下內容:
[root@gg1 ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* allthe otherinit scripts.
# You can put your own initialization stuffin hereif you don't
# want to do the full Sys V style initstuff.
touch /var/lock/subsys/local
su - oracle-c"/u01/app/oracle/product/11.2.0.3/db_1/bin/dbstart"
su - oracle-c"/u01/app/oracle/product/11.2.0.3/db_1/bin/emctl start dbconsole"
這裏注意必須用oracle 用戶來啓動腳本。
4 reboot 系統,Oracle就自動啓動了。
在我們的配置中,啓動的包括監聽,實例和OEM。
啓動日誌如下:
gg1:/u01/app/oracle/product/11.2.0.3/db_1>catstartup.log
/u01/app/oracle/product/11.2.0.3/db_1/bin/dbstart:Startingup database "gg1"
Mon Jan 30 20:48:26 CST 2012
SQL*Plus: Release 11.2.0.3.0 Production onMon Jan30 20:48:31 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> Connected to an idle instance.
SQL> ORACLE instance started.
Total System Global Area 939495424 bytes
Fixed Size 2233960 bytes
Variable Size 675285400 bytes
Database Buffers 255852544 bytes
Redo Buffers 6123520 bytes
Database mounted.
Database opened.
SQL> Disconnected from Oracle Database11gEnterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining andRealApplication Testing options
/u01/app/oracle/product/11.2.0.3/db_1/bin/dbstart:Databaseinstance "gg1" warm started.
gg1:/u01/app/oracle/product/11.2.0.3/db_1>catlistener.log
/u01/app/oracle/product/11.2.0.3/db_1/bin/dbstart:StartingOracle Net Listener
LSNRCTL for Linux: Version 11.2.0.3.0 -Productionon 30-JAN-2012 21:24:37
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting/u01/app/oracle/product/11.2.0.3/db_1/bin/tnslsnr:please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 -Production
System parameter fileis/u01/app/oracle/product/11.2.0.3/db_1/network/admin/listener.ora
Log messages writtento/u01/app/oracle/diag/tnslsnr/gg1/listener/alert/log.xml
Listeningon:(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gg1)(PORT=1521)))
Listeningon:(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=gg1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux:Version11.2.0.3.0 - Production
Start Date 30-JAN-2012 21:24:40
Uptime 0 days 0 hr. 0 min. 1 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0.3/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/gg1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gg1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
參考:Dave的blog http://blog.csdn.net/tianlesoftware/article/details/6246151
http://blog.csdn.net/tianlesoftware/article/details/7220657