10.安裝並創建數據庫
在root用戶下,先將光盤中的oracle數據庫軟件拷到根目錄下,然後再執行: unzip 10201_database_linux32.zip
mv database/* /home/oracle
su – oracle(切換到oracle用戶下)
du –sh ./database/ 【查看文件的大,因爲文件正在傳送】
cd database(當數據庫從根目錄都拷到oracle用戶的家目錄下時,再進入該目錄)
ls
進行系統檢測:
./runInstaller(請以KDE視窗模式下進入.否則無法執行runInstaller)
如果出現以下問題:
[oracle@oracle ~]$ ./runInstaller
Starting Oracle Universal Installer...
Checking installer requirements...
Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
Passed
All installer requirements met.
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2009-06-07_12-13-22PM. Please wait ...[oracle@localhost database]$ Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using 'localhost:0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Unknown Source)
at java.awt.Window.init(Unknown Source)
at java.awt.Window.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at oracle.ewt.popup.PopupFrame.<init>(Unknown Source)
at oracle.ewt.lwAWT.BufferedFrame.<init>(Unknown Source)
at oracle.sysman.oio.oioc.OiocOneClickInstaller.<init>(OiocOneClickInstaller.java:378)
at oracle.sysman.oio.oioc.OiocOneClickInstaller.main(OiocOneClickInstaller.java:2091)
解決辦法:需要切換到root用戶執行xhost +
如果還不成功,則在切換到oracle用戶,並執行export DISPLAY=0.0
出現以下圖形界面,我們選擇高級安裝模式:
根據提示,此時我們需要切換到兩個目錄下,分別執行程序:
cd /u01/app/oracle/oraInventory/
./orainstRoot.sh
cd /u01/app/oracle/product/10.2.0/db_1
./root.sh
然後點擊ok即可,隨即出現安裝完成界面,點擊退出即可。
以上會出現是否同意的信息,使管點擊I aggress即可。
到此爲止,安裝已經全部結束,數據庫也創建了。(有人可能會在安裝數據庫的時候沒有創建數據庫,這時就可以用dbca創建,注意:dbca是創建數據庫幫手,可以幫你創建數據庫)
如果上圖中出現Java的錯誤提示信息,則需要編輯/u01/app/oracle/product/10.2.0/db_1/sysman/config,在此文件中加入
agentTZRegin=Asia/Shanghai
11.下面是對數據庫的管理:
[oracle@oracle ~]$emctl stop dbconsole(用於停止監聽器)
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://oracle.example.com:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
... Stopped.
[oracle@oracle ~]$
[oracle@oracle ~]$ emctl start dbconsole(用於開啓監聽器)
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://oracle.example.com:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control ............... started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/oracle.example.com_orcl/sysman/log
[oracle@oracle ~]$
如果監聽程序沒有開啓,執行以下命令可以開啓:
[oracle@oracle ~]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 21-MAR-2010 22:45:57
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle.example.com)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 21-MAR-2010 22:45:57
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle.example.com)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@oracle ~]$
文件/u01/app/oracle/product/10.2.0/db_1/install/portlist.ini中定義了監聽的端口:
iSQL*Plus HTTP port number =5560
Enterprise Manager Console HTTP Port (orcl) = 1158
Enterprise Manager Agent Port (orcl) = 3938
查看監聽端口:
[oracle@oracle install]$ netstat -tunlp|grep 1158
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:1158 0.0.0.0:* LISTEN 8934/java
[oracle@oracle install]$
[oracle@oracle ~]$ sqlplus / as sysdba(以sysdba的身份登錄數據庫)
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 21 22:56:50 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from v$instance;
INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
HOST_NAME
----------------------------------------------------------------
VERSION STARTUP_T STATUS PAR THREAD# ARCHIVE LOG_SWITCH_WAIT
----------------- --------- ------------ --- ---------- ------- ---------------
LOGINS SHU DATABASE_STATUS INSTANCE_ROLE ACTIVE_ST BLO
---------- --- ----------------- ------------------ --------- ---
1 orcl
oracle.example.com
10.2.0.1.0 21-MAR-10 OPEN NO 1 STOPPED
ALLOWED NO ACTIVE PRIMARY_INSTANCE NORMAL NO
SQL> select INSTANCE_NAME from v$instance; (查看當前運行的實例)
INSTANCE_NAME
----------------
orcl
[oracle@oracle database]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Mar 22 08:01:33 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 356515840 bytes
Fixed Size 1219400 bytes
Variable Size 113247416 bytes
Database Buffers 239075328 bytes
Redo Buffers 2973696 bytes
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options