文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

Oracle手工建库教程

2024-04-02 19:55

关注

系统环境:

操作系统: RedHat EL6

Oracle:  Oracle 10g and Oracle 11g

   手工建库相对来说很容易实现,本案例是从10g和11g,通过手工建库的方式做一个简单的对比,可以看出11g和10g之间的一个简单的差异!

案例一:

在Oracle 10g 环境下手工建库

DB_NAME='cuug'

INSTANCE_NAME='cuug'

1、建立Instance的初始化参数文件和口令文件:

[oracle@oracle dbs]$ cat initcuug.ora

db_name = cuug

db_block_size = 8192

pga_aggregate_target = 30M                               

db_cache_size = 80M                               

shared_pool_size = 60M                                 

parallel_threads_per_cpu = 4                                 

optimizer_mode = choose

star_transformation_enabled = true

db_file_multiblock_read_count = 16

query_rewrite_enabled = true

query_rewrite_integrity = trusted

background_dump_dest = $ORACLE_BASE/admin/cuug/bdump

user_dump_dest = $ORACLE_BASE/admin/cuug/udump

core_dump_dest = $ORACLE_BASE/admin/cuug/cdump

control_files = $ORACLE_BASE/oradata/cuug/control01.ctl

undo_management = auto

undo_tablespace = rtbs

[oracle@oracle dbs]$orapwd file=orapwcuug password=oracle entries=3


2、建立数据库相关目录

[oracle@oracle dbs]$ mkdir -p $ORACLE_BASE/admin/cuug/bdump

[oracle@oracle dbs]$ mkdir -p $ORACLE_BASE/admin/cuug/cdump

[oracle@oracle dbs]$ mkdir -p $ORACLE_BASE/admin/cuug/udump

[oracle@oracle dbs]$ mkdir -p $ORACLE_BASE/oradata/cuug


3、建立建库脚本(参考Oracle 11g Online)

[oracle@oracle dbs]$cat cr_db.sql

create database cuug

  user sys identified by oracle

  user system identified by oracle

datafile '$ORACLE_BASE/oradata/cuug/system01.dbf' size 300m

sysaux datafile '$ORACLE_BASE/oradata/cuug/sysaux01.dbf' size 100m

default temporary tablespace temp tempfile '$ORACLE_BASE/oradata/cuug/temp01.dbf' size 100m

undo tablespace rtbs datafile '$ORACLE_BASE/oradata/cuug/rtbs01.dbf' size 100m

logfile

   group 1 '$ORACLE_BASE/oradata/cuug/redo01a.log' size 10m,

   group 2 '$ORACLE_BASE/oradata/cuug/redo02a.log' size 10m

character set zhs16gbk;


4、启动Instance建立数据库

[oracle@oracle dbs]$export ORACLE_SID=cuug

[oracle@oracle dbs]$sqlplus '/as sysdba'

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.sql

Database created.


查看告警日志信息(alert_cuug.log);

[oracle@oracle dbs]tail -f /u01/app/oracle/admin/cuug/bdump/alert_cuug.log

create tablespace SYSTEM datafile  '$ORACLE_BASE/oradata/test/system01.dbf' size 400m

  default storage (initial 10K next 10K) online

Sat Aug 20 00:26:34 2011

Completed: create tablespace SYSTEM datafile  '$ORACLE_BASE/oradata/test/system01.dbf' size 400m

  default storage (initial 10K next 10K) EXTENT MANAGEMENT DICTIONARY online

Sat Aug 20 00:26:34 2011

create rollback segment SYSTEM tablespace SYSTEM

  storage (initial 50K next 50K)

Completed: create rollback segment SYSTEM tablespace SYSTEM

  storage (initial 50K next 50K)

Sat Aug 20 00:26:49 2011

Thread 1 advanced to log sequence 2

  Current log# 2 seq# 2 mem# 0: /u01/app/oracle/oradata/test/redo02a.log

Sat Aug 20 00:26:50 2011

CREATE UNDO TABLESPACE RTBS DATAFILE  '$ORACLE_BASE/oradata/test/rtbs01.dbf' size 100m

Sat Aug 20 00:26:51 2011

Successfully onlined Undo Tablespace 1.

Completed: CREATE UNDO TABLESPACE RTBS DATAFILE  '$ORACLE_BASE/oradata/test/rtbs01.dbf' size 100m

Sat Aug 20 00:26:51 2011

create tablespace SYSAUX datafile  '$ORACLE_BASE/oradata/test/sysaux01.dbf' size 100m

  EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO online

Completed: create tablespace SYSAUX datafile  '$ORACLE_BASE/oradata/test/sysaux01.dbf' size 100m

  EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO online

Sat Aug 20 00:26:54 2011

CREATE TEMPORARY TABLESPACE TEMP TEMPFILE  '$ORACLE_BASE/oradata/test/temp01.dbf' size 100m

Completed: CREATE TEMPORARY TABLESPACE TEMP TEMPFILE  '$ORACLE_BASE/oradata/test/temp01.dbf' size 100m

Sat Aug 20 00:26:55 2011

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP

Completed: ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP

Sat Aug 20 00:26:55 2011

ALTER DATABASE DEFAULT TABLESPACE SYSTEM 

Completed: ALTER DATABASE DEFAULT TABLESPACE SYSTEM 

Sat Aug 20 00:27:01 2011

SMON: enabling tx recovery

Sat Aug 20 00:27:02 2011

Threshold validation cannot be done before catproc is loaded.

replication_dependency_tracking turned off (no async multimaster replication found)

Starting background process QMNC

QMNC started with pid=13, OS id=6485

Sat Aug 20 00:27:03 2011

Completed: create database test

 user sys identified by **user system identified by *datafile '$ORACLE_BASE/oradata/test/system01.dbf' size 400m

sysaux datafile '$ORACLE_BASE/oradata/test/sysaux01.dbf' size 100m

undo tablespace rtbs datafile '$ORACLE_BASE/oradata/test/rtbs01.dbf' size 100m

default temporary tablespace temp tempfile '$ORACLE_BASE/oradata/test/temp01.dbf' size 100m

logfile

  group 1 '$ORACLE_BASE/oradata/test/redo01a.log' size 10m,

  group 2 '$ORACLE_BASE/oradata/test/redo02a.log' size 10m,

  group 3 '$ORACLE_BASE/oradata/test/redo03a.log' size 10m

character set zhs16gbk


5、建立数据字典

数据字典脚本:

[oracle@oracle dbs]cat cr_dict.sql

@$ORACLE_HOME/rdbms/admin/catalog.sql

@$ORACLE_HOME/rdbms/admin/catproc.sql

conn system/oracle

@$ORACLE_HOME/sqlplus/admin/pupbld.sql

11:20: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/cuug/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 ~]$ 

@至此,手工建库完成!

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     807人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     351人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     314人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     433人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     221人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯