oracle 10g 手动建库

前题已经安装好数据库软件。以下开始手动建库操作:

1.设置oracle用户环境变量
[root@node1 /]# cat /home/oracle/.bash_profile
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/10.1.2/db
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
NLS_LANG=american_america.AL32UTF8
NLS_DATE_FORMAT=YYYY-MM-DD:HH24:MI:SS
export ORACLE_SID ORACLE_BASE ORACLE_HOME PATH LD_ASSUME_KERNEL LD_LIBRARY_PATH NLS_LANG NLS_DATE_FORMAT

2.创建数据库密码口令文件:
[oracle@node1 dbs]$ orapwd file=orapworcl password=oracledb entries=5
3.创建数据库需要的相关目录
[oracle@node1 dbs]$ mkdir -p /u01/app/oracle/admin/orcl
[oracle@node1 dbs]$ mkdir -p /u01/app/oracle/oradata/orcl
[oracle@node1 dbs]$ mkdir -p /u01/app/oracle/admin/orcl/{adump,bdump,cdump,udump}
[oracle@node1 dbs]$ mkdir -p /u01/app/oracle/flash_recovery_area

4.创建数据库参数文件:
[oracle@node1 dbs]$ vi initorcl.ora
*.db_name=orcl
*.db_block_size=8192
*.db_file_multiblock_read_count=16
*.db_unique_name='orcl'
*.sga_target=285212672
*.undo_retention=900
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=300
*.control_files = ('/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control012ctl','/u01/app/oracle/oradata/orcl/control03.ctl')
*.user_dump_dest='/u01/app/oracle/admin/orcl/udump'
*.background_dump_dest='/u01/app/oracle/admin/orcl/bdump'
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.core_dump_dest='/u01/app/oracle/admin/orcl/cdump'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.compatible=10.2.0.1.0
*.remote_login_passwordfile=EXCLUSIVE

5.配置数据库创建SQL:
[oracle@node1 dbs]$ cat create_db.sql
CREATE DATABASE orcl
USER SYS IDENTIFIED BY "oracledb"
USER SYSTEM IDENTIFIED BY "oracledb"
LOGFILE
GROUP 1 ('/u01/app/oracle/oradata/orcl/redo01.dbf') SIZE 50M,
GROUP 2 ('/u01/app/oracle/oradata/orcl/redo02.dbf') SIZE 50M,
GROUP 3 ('/u01/app/oracle/oradata/orcl/redo03.dbf') SIZE 50M
MAXLOGFILES 10
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/u01/app/oracle/oradata/orcl/system01.dbf' SIZE 200M REUSE autoextend on next 1m maxsize unlimited EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf' SIZE 100M REUSE autoextend on next 1m maxsize unlimited
DEFAULT TEMPORARY TABLESPACE temp TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20M REUSE autoextend on next 640k maxsize unlimited
UNDO TABLESPACE undotbs1 DATAFILE '/u01/app/oracle/oradata/orcl/undotbs1.dbf' SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED;

6.开始创建数据库实例:
[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Oct 24 05:42:55 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.

SQL> startup nomount
ORACLE instance started.
Total System Global Area  285212672 bytes
Fixed Size      1218992 bytes
Variable Size     92276304 bytes
Database Buffers   188743680 bytes
Redo Buffers      2973696 bytes
SQL> @/home/oracle/create_db.sql;
Database created.

7.数据库创建完成后,继续创建ORACLE的数据字典。
SQL> @$ORACLE_HOME/rdbms/admin/catalog.sql;
PL/SQL procedure successfully completed.

SQL> @$ORACLE_HOME/rdbms/admin/catproc.sql;
PL/SQL procedure successfully completed.
SQL> @$ORACLE_HOME/rdbms/admin/catexp.sql
Commit complete.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size             104859216 bytes
Database Buffers          176160768 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
SQL> create tablespace users datafile '/u01/app/oracle/oradata/orcl/users01.dbf' size 200M
  2  autoextend on maxsize 4G;
Tablespace created.

SQL> col file_name format a46
SQL> select file_name,tablespace_name from dba_data_files;

FILE_NAME           TABLESPACE_NAME
---------------------------------------------- ------------------------------
/u01/app/oracle/oradata/orcl/system01.dbf      SYSTEM
/u01/app/oracle/oradata/orcl/undotbs1.dbf      UNDOTBS1
/u01/app/oracle/oradata/orcl/sysaux01.dbf      SYSAUX
/u01/app/oracle/oradata/orcl/users01.dbf       USERS

[oracle@node1 ~]$ rman target /
RMAN> list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORCL     1293132707       CURRENT 1          2011-11-16 :21:46:11

手动创建数据完毕。

本文出自 “旋木的技术博客” 博客,谢绝转载!

你可能感兴趣的:(oracle,oracle,职场,10g,休闲,手动建库)