?? oracle-howto.txt
字號:
'$ORACLE_HOME/dbs/orcl_redo_02.dbf' size 1M reuse, '$ORACLE_HOME/dbs/orcl_redo_03.dbf' size 1M reuse;@$ORACLE_HOME/rdbms/admin/catalog.sqlcreate tablespace rollback datafile '$ORACLE_HOME/dbs/orcl_roll_01.dbf' size 8.5M reuse;create tablespace temp datafile '$ORACLE_HOME/dbs/orcl_temp_01.dbf' size 5M reuse temporary;create tablespace users datafile '$ORACLE_HOME/dbs/orcl_user_01.dbf' size 10M reuse;create rollback segment r1 tablespace rollback storage ( optimal 5M );alter rollback segment r1 online;connect system/manager@$ORACLE_HOME/rdbms/admin/catdbsyn.sqlconnect internal@$ORACLE_HOME/rdbms/admin/catproc.sqlconnect system/manager@$ORACLE_HOME/sqlplus/admin/pupbld.sqlspool offexit ______________________________________________________________ 3.3 執行資料庫的安裝安令稿 開始 svrmgrl 及執行命令稿∶ ______________________________________________________________ $ cd $ORACLE_HOME/dbs$ svrmgrlOracle Server Manager Release 2.3.3.0.0 - ProductionCopyright (c) Oracle Corporation 1994, 1995. All rights reserved.Oracle7 Server Release 7.3.3.0.0 - Production ReleasePL/SQL Release 2.3.3.0.0 - ProductionSVRMGR> connect internalConnected.SVRMGR> startup nomountORACLE instance started.Total System Global Area 4313312 bytesFixed Size 41876 bytesVariable Size 4140364 bytesDatabase Buffers 122880 bytesRedo Buffers 8192 bytesSVRMGR> @makedb<loads of messages>SVRMGR> exitServer Manager complete. ______________________________________________________________ 3.4 啟動資料庫 開始時,我們要親手啟動資料庫(我們稍後會把這工件自動化)。要啟動 Oracle 的資料庫,我們要來內部連接 (connected internally) 了的情況下執行 startup 指令: ______________________________________________________________ $ svrmgrlOracle Server Manager Release 2.3.3.0.0 - ProductionCopyright (c) Oracle Corporation 1994, 1995. All rights reserved.Oracle7 Server Release 7.3.3.0.0 - Production ReleasePL/SQL Release 2.3.3.0.0 - ProductionSVRMGR> connect internalConnected.SVRMGR> startupORACLE instance started.Total System Global Area 4313316 bytesFixed Size 41876 bytesVariable Size 4140368 bytesDatabase Buffers 122880 bytesRedo Buffers 8192 bytesDatabase mounted.Database opened.SVRMGR> exitServer Manager complete. ______________________________________________________________ 3.5 停止資料庫 先旨聲明,在未關閉一個 Oracle 資料庫的情況下重新啟動 Linux 很有可能會使 資料庫損毀。 因此,在我們執行 Linux 的 shutdown 指令前最好先關閉資料庫: ______________________________________________________________ $ svrmgrlOracle Server Manager Release 2.3.3.0.0 - ProductionCopyright (c) Oracle Corporation 1994, 1995. All rights reserved.Oracle7 Server Release 7.3.3.0.0 - Production ReleasePL/SQL Release 2.3.3.0.0 - ProductionSVRMGR> connect internalConnected.SVRMGR> shutdownDatabase closed.Database dismounted.ORACLE instance shut down.SVRMGR> exitServer Manager complete. ______________________________________________________________ 3.6 建立內定用戶 (Default User) 在建立資料庫時,會自動產生兩個特別的用戶: ______________________________________________________________ Username PasswordSYSTEM MANAGERSYS change_on_install ______________________________________________________________ 這些用戶通常是用來保存標準的資料字典 (data dictionary) 資料在資料庫中。 盡快把密碼修改是一個好主意。 可以這樣做: ______________________________________________________________ sqlplus system/managerSQL*Plus: Release 3.3.3.0.0 - Production on Sat Feb 21 12:43:33 1998Copyright (c) Oracle Corporation 1979, 1996. All rights reserved.Connected to:Oracle7 Server Release 7.3.3.0.0 - Production ReleaseSQL> alter user system identified by <newpassword>;User altered.SQL> alter user sys identified by <newpassword>;User altered.SQL> exit;Disconnected from Oracle7 Server Release 7.3.3.0.0 - Production ReleasePL/SQL Release 2.3.3.0.0 - Production ______________________________________________________________ 用戶 system/manager 就如 UNIX 中的 root,因此我們要建立另一個權力較少的 用戶以防損失。(記著要先開啟資料庫才建立用戶。) 連接到 SQL*Plus 及建立用戶: ______________________________________________________________ $ sqlplus system/managerSQL*Plus: Release 3.3.3.0.0 - Production on Sat Feb 21 12:43:33 1998Copyright (c) Oracle Corporation 1979, 1996. All rights reserved.Connected to:Oracle7 Server Release 7.3.3.0.0 - Production ReleasePL/SQL Release 2.3.3.0.0 - ProductionSQL> create user <user> identified by <psw> 2 default tablespace users 3 temporary tablespace temp;User created.SQL> grant connect, resource to <user>Grant succeeded.SQL> exitDisconnected from Oracle7 Server Release 7.3.3.0.0 - Production ReleasePL/SQL Release 2.3.3.0.0 - Production ______________________________________________________________ 系統中已有一個新用戶,你可以用他來試用新系統。要簽入 Oracle 資料庫: ______________________________________________________________ $ sqlplus <user>/<password> ______________________________________________________________ 如果這在沒有錯誤訊息的情況下完成,你已有一個運作中的 Oracle 資料庫。如 果你只會從這部電腦連接到這資料庫,而不會從其他地方,你可休息了! 不過,如果你像大部分人般想設定網絡軟件使你可以從其他電腦連接,請繼續讀 下去。 4. 在伺服器上設定 SQL*Net 所有這些檔案都會用於設定 Oracle 的網絡軟件(SQL*Net,和 Oracle8 的 Net8 差不多)。這些檔案應該都建立在伺服器中的 $ORACLE_HOME/network/admin 目錄。 4.1 tnsnames.ora TNSNAMES.ORA 檔設定所有這電腦提供的服務。現在我們描述所有掛上了伺服器的 資料庫。對伺服器上所有資料庫你要加上類似以下的一段: ______________________________________________________________ orcl.world = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = <INSERT HOST NAME OF SERVER HERE> ) (Port = 1521) ) (ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = <INSERT HOST NAME OF SERVER HERE> ) (Port = 1526) ) ) (CONNECT_DATA = (SID = ORCL) ) ) ______________________________________________________________ 4.2 listener.ora listener.ora 檔描述所有其他電腦可得到的服務及伺服器的監聽程式 (listener) 所需的所有設定。 它有一段包括監聽程式名稱、監聽程式地址、監聽程式提供服務的資料庫及參數 設定 (listener name, listener address, databases served by the listener and configuration parameters)。 這里有一個例子: ______________________________________________________________ # 監聽程式名稱及所收聽的地址LISTENER = ( ADDRESS_LIST = (ADDRESS = (PROTOCOL=tcp) (HOST=<INSERT HOST>) (PORT=1521) (COMMUNITY=UK_SUP_TCPIP) ) (ADDRESS = (PROTOCOL=ipc) (KEY=700) (COMMUNITY=UK_SUP_TCPIP) ) )# 列出監聽程式提供的服務SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (SID_NAME=orcl) (ORACLE_HOME=/home/oracle/7.3.3.0.0) ) )# 開始參數設定TRACE_LEVEL_LISTENER=OFFTRACE_FILE_LISTENER = "listener"LOG_FILE_LISTENER = "listener"CONNECT_TIMEOUT_LISTENER = 10STOP_LISTENER = YESDBA_GROUP = dba ______________________________________________________________ 4.3 sqlnet.ora sqlnet.ora 檔包括對網絡上一個特定節點 (node) 的設定。這些資料和資料庫的 數目及監聽程式的數目無關。這個檔案中最重要的東西是 Dead Connection Timeout 變數的設定。 Dead connection timeout 檢查每一個接到該資料庫的行程及確保用戶端仍有反 應。如果那用戶(類型不拘)并無反應,對應的 Oracle 伺服器影子行程 (shadow process) 便會被殺。 如果你有很多用戶存取那資料庫,這點非常有用。尤其是當你仍在程式開發階段 ,用戶多數不能正確地結□的時候。 以下是我的 sqlnet.ora 檔,供各讀者參考: ______________________________________________________________ TRACE_LEVEL_CLIENT = OFFsqlnet.expire_time = 30 # 兩次檢查客戶相差的秒數names.default_domain = worldname.default_zone = world ______________________________________________________________ 4.4 開始及結□監聽程式 現在有關監聽程式及 SQL*Net 的設定已經完成,我們可以試用網絡軟件來駁到資 料庫。(之前我們只是直接連接到資料庫,現在則是在模擬使用遠程 (remote) 用戶。) 使用以上的設定來啟動監聽程式: ______________________________________________________________ $ lsnrctlLSNRCTL for SCO System V/386: Version 2.3.3.0.0 - Production on 23-FEB-98 20:38:25Copyright (c) Oracle Corporation 1994. All rights reserved.Welcome to LSNRCTL, type "help" for information.LSNRCTL> startStarting /home/oracle/7.3.3.0.0/bin/tnslsnr: please wait...
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -