您好,登录后才能下订单哦!
Oracle 10g AND Oracle 11g手工建库案例--Oracle 11g
系统环境:
操作系统: RedHat EL6
Oracle: Oracle 10g and Oracle 11g
手工建库相对来说很容易实现,本案例是从10g和11g,通过手工建库的方式做一个简单的对比,可以看出11g和10g之间的一个简单的差异!
案例二:
在Oracle 11g 环境下手工建库
DB_NAME='test1'
INSTANCE_NAME='test1'
1、建立Instance的初始化参数文件和口令文件
[oracle@rh7 dbs]$cat inittest1.ora
db_name='test1'
memory_target=400m //Oracle 11g增加了内存自动管理
processes = 150
audit_file_dest='$ORACLE_BASE/admin/test1/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = /u01/app/oracle/oradata/test1/control01.ctl
compatible ='11.2.0'
[oracle@rh7 dbs]$ orapwd file=orapwtest1 password=oracle entries=3
2、建立数据库相关的目录
Oracle 11g增加了diagnostic directory,默认的为$ORACLE_BASE
[oracle@rh7 dbs]$ mkdir -p $ORACLE_BASE/admin/test1/adump
[oracle@rh7 dbs]$ mkdir -p /u01/app/oracle/oradata/test1
3、建立建库脚本
[oracle@rh7 ~]$ cat cr_db.sql
CREATE DATABASE test1
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE
GROUP 1 ('/u01/app/oracle/oradata/test1/redo01a.log') SIZE 50M ,
GROUP 2 ('/u01/app/oracle/oradata/test1/redo02a.log') SIZE 50M
MAXLOGFILES 10
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 200
CHARACTER SET zhs16gbk
DATAFILE '/u01/app/oracle/oradata/test1/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/test1/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/test1/temp01.dbf'
SIZE 100M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/test1/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
4、启动Instance并建立数据库
[oracle@rh7 ~]$ export ORACLE_SID=test1
[oracle@rh7 ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Wed May 21 10:59:58 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
10:59:59 SYS@ test1>startup nomount;
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2213936 bytes
Variable Size 268437456 bytes
Database Buffers 142606336 bytes
Redo Buffers 4288512 bytes
11:00:12 SYS@ test1>@/home/oracle/cr_db
Database created.
Elapsed: 00:01:23.44
11:01:51 SYS@ test1>
建库告警日志:
CREATE TABLESPACE sysaux DATAFILE '/u01/app/oracle/oradata/test1/sysaux01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ONLINE
Wed May 21 11:01:08 2014
Completed: CREATE TABLESPACE sysaux DATAFILE '/u01/app/oracle/oradata/test1/sysaux01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ONLINE
processing ?/rdbms/admin/dplsql.bsq
processing ?/rdbms/admin/dtxnspc.bsq
CREATE UNDO TABLESPACE UNDOTBS1 DATAFILE '/u01/app/oracle/oradata/test1/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
Wed May 21 11:01:23 2014
Successfully onlined Undo Tablespace 2.
Completed: CREATE UNDO TABLESPACE UNDOTBS1 DATAFILE '/u01/app/oracle/oradata/test1/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
CREATE TEMPORARY TABLESPACE TEMPTS1 TEMPFILE '/u01/app/oracle/oradata/test1/temp01.dbf'
SIZE 100M REUSE
Completed: CREATE TEMPORARY TABLESPACE TEMPTS1 TEMPFILE '/u01/app/oracle/oradata/test1/temp01.dbf'
SIZE 100M REUSE
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMPTS1
Completed: ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMPTS1
ALTER DATABASE DEFAULT TABLESPACE SYSTEM
Completed: ALTER DATABASE DEFAULT TABLESPACE SYSTEM
processing ?/rdbms/admin/dfmap.bsq
processing ?/rdbms/admin/denv.bsq
processing ?/rdbms/admin/drac.bsq
processing ?/rdbms/admin/dsec.bsq
processing ?/rdbms/admin/doptim.bsq
processing ?/rdbms/admin/dobj.bsq
processing ?/rdbms/admin/djava.bsq
processing ?/rdbms/admin/dpart.bsq
Wed May 21 11:01:34 2014
processing ?/rdbms/admin/drep.bsq
processing ?/rdbms/admin/daw.bsq
processing ?/rdbms/admin/dsummgt.bsq
processing ?/rdbms/admin/dtools.bsq
processing ?/rdbms/admin/dexttab.bsq
processing ?/rdbms/admin/ddm.bsq
processing ?/rdbms/admin/dlmnr.bsq
processing ?/rdbms/admin/ddst.bsq
Wed May 21 11:01:43 2014
SMON: enabling tx recovery
Starting background process SMCO
Wed May 21 11:01:44 2014
SMCO started with pid=17, OS id=2816
Wed May 21 11:01:50 2014
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Wed May 21 11:01:50 2014
QMNC started with pid=20, OS id=2826
Completed: CREATE DATABASE test1
USER SYS IDENTIFIED BY ****USER SYSTEM IDENTIFIED BY ****LOGFILE
GROUP 1 ('/u01/app/oracle/oradata/test1/redo01a.log') SIZE 50M ,
GROUP 2 ('/u01/app/oracle/oradata/test1/redo02a.log') SIZE 50M
MAXLOGFILES 10
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 200
CHARACTER SET zhs16gbk
DATAFILE '/u01/app/oracle/oradata/test1/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/test1/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/test1/temp01.dbf'
SIZE 100M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/test1/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
5、建立数据字典
数据字典脚本:
[oracle@rh7 ~]$ cat cr_dict.sql
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql
11:00:12 SYS@ test1>@/home/oracle/cr_dict.sql
6、建立Users表空间并设为默认表空间
系统默认的表空间为system,如果以system为默认表空间,会影响数据库的管理和性能
12:09:56 SQL> create tablespace users
12:10:01 2 datafile '/u01/app/oracle/oradata/test1/user01.dbf' size 100m;
Tablespace created.
12:10:41 SQL> alter database default tablespace users;
Database altered.
7、添加example案例
12:11:45 SQL> @$ORACLE_HOME/rdbms/admin/utlsampl.sql
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@oracle ~]$
从以上Oracle 10g 和 Oracle 11g 手工建库,没有什么大的变化;只是Oracle 11g增加内存自动管理和诊断目录等新的特性,所以在建库时略微有点变化!
@至此,手工建库完成!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。