oracle10g linux 手工建庫

YallonKing發表於2011-08-16

閒來無事,貼我以前的一篇,算是複習了....

知識獲得不易,轉載請註明出處!

1、  設定環境變數
[root@xlong ~]# su - oracle
[oracle@xlong ~]$ export ORACLE_SID=xlong01
[oracle@xlong ~]$ env | grep ORA
ORACLE_NLS33=/u01/app/oracle/product/10.2.0/db_1/ocommon/nls/admin/data
ORACLE_SID=xlong01
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
2、  建立口令檔案
[oracle@xlong dbs]$ orapwd file=orapwtest password=oracle entries=10
3、  建立靜態初始化引數檔案(pfile)
[oracle@xlong dbs]$ vi initxlong01.ora
db_cache_size=176160768
java_pool_size=4194304
large_pool_size=4194304
shared_pool_size=96468992
streams_pool_size=0
audit_file_dest='/u01/app/oracle/admin/xlong01/adump'
background_dump_dest='/u01/app/oracle/admin/xlong01/bdump'
compatible='10.2.0.1.0'
control_files=('/u01/app/oracle/oradata/xlong01/control01.ctl','/u01/app/oracle/oradata/xlong01/control02.ctl','/u01/app/oracle/oradata/xlong01/control03.ctl')
core_dump_dest='/u01/app/oracle/admin/xlong01/cdump'
db_block_size=8192
db_create_file_dest='/u01/app/oracle/oradata'
db_domain=''
db_file_multiblock_read_count=16
db_name='xlong01'
db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=2147483648
dispatchers='(PROTOCOL=TCP) (SERVICE=xlong01XDB)'
job_queue_processes=10
open_cursors=300
pga_aggregate_target=94371840
processes=150
remote_login_passwordfile='EXCLUSIVE'
sga_target=285212672
undo_management='AUTO'
undo_tablespace='UNDOTBS1'
user_dump_dest='/u01/app/oracle/admin/xlong01/udump'
4、  建立所需目錄
(此處根據initxlong01.ora引數中的相關設定建立)
[oracle@xlong admin]$ mkdir xlong01
[oracle@xlong xlong01]$ mkdir adump
[oracle@xlong xlong01]$ mkdir bdump
[oracle@xlong xlong01]$ mkdir cdump
[oracle@xlong xlong01]$ mkdir dpdump
[oracle@xlong xlong01]$ mkdir pfile
[oracle@xlong xlong01]$ mkdir scripts
[oracle@xlong xlong01]$ mkdir udump
[oracle@xlong oradata]$ mkdir xlong01
5、  連線到例項
[oracle@xlong dbs]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jan 29 04:40:27 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn /as sysdba
Connected to an idle instance.
6、  建立動態初始化引數檔案(spfile)(optional)
SQL> create spfile from pfile;
File created.
 7、  啟動例項
startup nomount pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initxlong01.ora'  (optional)
SQL> startup nomount;
8、  執行CREATE DATABASE 語句
(此處通過檔案createdb.sql進行)
建立createdb.sql檔案
[oracle@xlong dbs]$ vi createdb.sql
spool dbcreate.log;
create database xlong01
user sys identified by oracle
user system identified by oracle
logfile group 1 ('/u01/app/oracle/oradata/xlong01/redo01.log') size 10m reuse,
        group 2 ('/u01/app/oracle/oradata/xlong01/redo02.log') size 10m reuse,
        group 3 ('/u01/app/oracle/oradata/xlong01/redo03.log') size 10m reuse
datafile '/u01/app/oracle/oradata/xlong01/xlong0101.dbf' size 500m reuse extent management local
maxdatafiles 100
maxlogmembers 5
maxloghistory 1
maxinstances 1
archivelog
character set US7ASCII
national character set AL16UTF16
sysaux datafile '/u01/app/oracle/oradata/xlong01/sys01.dbf' size 230m autoextend on next 10m maxsize unlimited
default tablespace tbs01 datafile '/u01/app/oracle/oradata/xlong01/tbs01.dbf' size 100m
undo tablespace undotbs1 datafile '/u01/app/oracle/oradata/xlong01/undo.dbf' size 100m
default temporary tablespace temp tempfile '/u01/app/oracle/oradata/xlong01/temp01.dbf'
size 100m autoextend on next 10m maxsize unlimited;
spool off;
執行檔案crdb01.sql
[oracle@xlong dbs]$ exit
exit
SQL> @$ORACLE_HOME/dbs/createdb.sql;
9、  建立額外的表空間
10、              執行相關指令碼
/u01/app/oracle/product/10.2.0/db_1/rdbms/admin
SQL>spool log01.log
SQL> @$ORACLE_HOME/rdbms/admin/catalog.sql;
SQL>spool log02.log
SQL> @$ORACLE_HOME/rdbms/admin/catproc.sql;
11、備份資料庫

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26143577/viewspace-704973/,如需轉載,請註明出處,否則將追究法律責任。

相關文章