标签:手工
1.设置环境变量
[oracle@HE3~]$ vi .bash_profile
exportPATH exportEDITOR=vi exportORACLE_SID=orcl exportORACLE_BASE=/u01/app/oracle exportORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 exportnls_date_format="yyyy-mm-dd hh24:mi:ss" exportPATH=/u01/app/oracle/product/11.2.0/dbhome_1/bin:$PATH exportLD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib #aliassqlplus=‘rlwrap sqlplus‘ #aliasrman=‘rlwrap rman‘ exportNLS_LANG=AMERICAN_AMERICA.ZHS16GBK
[oracle@HE3 ~]$ source .bash_profile
2.准备密码文件及初始化参数文件和创建数据库脚本
[oracle@HE3~]$ cd $ORACLE_HOME/dbs
[oracle@HE3dbs]$ ls
hc_orcl.dat init.ora initorcl.ora lkORCL
[oracle@HE3dbs]$ orapwd file=orapwdorcl password=oracle entries=30
[oracle@HE3dbs]$ ls
hc_orcl.dat init.ora initorcl.ora lkORCL orapwdorcl
[oracle@HE3 dbs]$ vi initorcl.ora
diagnostic_dest=‘/u01/app/oracle‘ db_name=‘orcl‘ memory_target=512M processes= 150 audit_file_dest=‘/u01/app/oracle/admin/orcl/adump‘ audit_trail=‘db‘ db_block_size=8192 db_domain=‘‘ db_recovery_file_dest=‘/u01/app/oracle/flash_recovery_area‘ db_recovery_file_dest_size=512M diagnostic_dest=‘/u01/app/oracle‘ open_cursors=300 remote_login_passwordfile=‘EXCLUSIVE‘ undo_tablespace=‘UNDOTBS1‘ control_files=(/u01/app/oracle/oradata/orcl/control01.ctl,/u01/app/oracle/oradata/orcl/control02.ctl) compatible=‘11.2.0‘
3.准备创建数据库需要的相关目录
[oracle@HE3dbs]$ mkdir -p /u01/app/oracle/admin/orcl/adump/
[oracle@HE3dbs]$ mkdir -p /u01/app/oracle/flash_recovery_area
[oracle@HE3dbs]$ mkdir -p /u01/app/oracle/oradata/orcl
[oracle@HE3dbs]$ ls
hc_orcl.dat init.ora initorcl.ora lkORCL orapwdorcl
4.开始手工建库
[oracle@ENMOEDU ENMOEDU]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 10 00:39:10 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1071333376 bytes
Fixed Size 1349732 bytes
Variable Size 620758940 bytes
Database Buffers 444596224 bytes
Redo Buffers 4628480 bytes
[oracle@HE3~]$ vi create_db.sql
CREATEDATABASE orcl USER SYS IDENTIFIED BY oracle USER SYSTEM IDENTIFIED BY oracle LOGFILE GROUP 1(‘/u01/app/oracle/oradata/orcl/redo01a.log‘,‘/u01/app/oracle/oradata/orcl/redo01b.log‘)SIZE 50M BLOCKSIZE 512, GROUP 2(‘/u01/app/oracle/oradata/orcl/redo02a.log‘,‘/u01/app/oracle/oradata/orcl/redo02b.log‘)SIZE 50M BLOCKSIZE 512, GROUP 3(‘/u01/app/oracle/oradata/orcl/redo03a.log‘,‘/u01/app/oracle/oradata/orcl/redo03b.log‘)SIZE 50M BLOCKSIZE 512 MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 CHARACTER SET ZHS16GBK NATIONAL CHARACTER SET AL16UTF16 EXTENT MANAGEMENT LOCAL DATAFILE‘/u01/app/oracle/oradata/orcl/system01.dbf‘ SIZE 325M REUSE SYSAUX DATAFILE‘/u01/app/oracle/oradata/orcl/sysaux01.dbf‘ SIZE 325M REUSE DEFAULT TABLESPACE users DATAFILE‘/u01/app/oracle/oradata/orcl/users01.dbf‘ SIZE 500M REUSE AUTOEXTEND ON MAXSIZEUNLIMITED DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE‘/u01/app/oracle/oradata/orcl/temp01.dbf‘ SIZE 20M REUSE UNDO TABLESPACE undotbs1 DATAFILE‘/u01/app/oracle/oradata/orcl/undotbs01.dbf‘ SIZE 200M REUSE AUTOEXTEND ON MAXSIZEUNLIMITED;
[oracle@HE3~]$ tail -100f /u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log
SQL>@/home/oracle/create_db.sql
Databasecreated.
SQL>@?/rdbms/admin/catalog.sql ----------------------------创建数据字典
……
PL/SQLprocedure successfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMPCATALOG 2016-01-26 00:07:42
SQL> @?/rdbms/admin/catproc.sql-----------------------------创建存储过程和数据库的包
......
SQL>
SQL> SELECT dbms_registry_sys.time_stamp(‘CATPROC‘) AS timestamp FROM DUAL;
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP CATPROC 2014-02-10 01:25:21
1 row selected.
SQL>
SQL> SET SERVEROUTPUT OFF
SQL>
SQL>
SQL> select status from v$instance;
STATUS
------------
OPEN
1 row selected.
SQL> quit
5.完成手工建库
标签:手工
原文地址:http://suifu.blog.51cto.com/9167728/1738675