您的位置:首页 > 数据库 > Oracle

Oracle 手工建立数据库

2009-07-08 10:43 405 查看
使用OMF手工创建数据库

测试环境:solaris10+Oracle 10G
第一步:
设置环境变量ORACLE_SID 可以通过直接修改 参数文件 也可以 export ORACLE_SID=xxxx

第二步:
建立目录:
adump dbump cdump udump pfile
第三步: 建立 参数文件
在pfile下面建立参数文件:
下面是我的参数文件

##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################

###########################################
# Cache and I/O
###########################################
db_block_size=8192
db_file_multiblock_read_count=32

###########################################
# Cursors and Library Cache
###########################################
open_cursors=300

###########################################
# Database Identification
###########################################
db_domain=""
db_name=mydb
################################
timed_statistics=false
###########################################
# Diagnostics and Statistics
###########################################
background_dump_dest=/seconddisk/root/oracle/product/10.2.0/db_1/admin/mydb/bdump
core_dump_dest=/seconddisk/root/oracle/product/10.2.0/db_1/admin/mydb/cdump
user_dump_dest=/seconddisk/root/oracle/product/10.2.0/db_1/admin/mydb/udump

###########################################
# File Configuration
###########################################
control_files=("/seconddisk/root/oracle/product/10.2.0/oradata/mydb/control01.ctl", "/seconddisk/root/oracle/product/10.2.0/oradata/mydb/control02.ctl", "/thirddisk/root/controlbackup/control03.ctl","/fourthdisk/root/controlbackup/control04.ctl")
db_recovery_file_dest=/seconddisk/root/oracle/product/10.2.0/db_1/flash_recovery_area
db_recovery_file_dest_size=2147483648

###########################################
# Job Queues
###########################################
job_queue_processes=10

###########################################
# Miscellaneous
###########################################
compatible=10.2.0.2.0

###########################################
# Optimizer
###########################################
star_transformation_enabled=TRUE
############################
utl_file_dir=/thirddisk/root/utl_dir/dir_loganaly
###########################################
# Processes and Sessions
###########################################
processes=150

###########################################
# SGA Memory
###########################################
sga_target=262144000
#########################
#OMF
db_create_file_dest= /seconddisk/root/oracle/product/10.2.0/oradata/mydb
db_create_online_log_dest_1=/thirddisk/root/redolog
db_create_online_log_dest_2=/fourthdisk/root/redolog
###########################################
# Security and Auditing
###########################################
audit_file_dest=/seconddisk/root/oracle/product/10.2.0/db_1/admin/mydb/adump
remote_login_passwordfile=EXCLUSIVE

###########################################
# Shared Server
###########################################
dispatchers="(PROTOCOL=TCP) (SERVICE=mydbXDB)"

###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=87031808

###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_management=AUTO
undo_tablespace=UNDOTBS1
#########################
#archive
log_archive_format=%t_%s_%r.dbf
#log_archive_dest='location=/seconddisk/root/oracle/product/10.2.0/oradata/archivedoc'
log_archive_dest_1="location=/thirddisk/root/archivedest"
log_archive_dest_2="location=/fourthdisk/root/archivedest"

第四步:
启动sqlplus
starup pfile='/xxx/xx/xxx/init.ora'
第五步:
执行准备号的脚本

create database mydb
maxlogfiles 10
maxloghistory 2
maxdatafiles 16
maxinstances 5
maxlogmembers 5
logfile
group 1 size 100M,
group 2 size 100M,
group 3 size 100M
datafile 'system01.dbf' size 200M autoextend on next 5M
sysaux datafile 'sysaux.dbf' size 200M
default temporary tablespace temp tempfile 'temp.dbf' size 50M autoextend on next 1m maxsize unlimited
undo tablespace undotbs1 datafile 'undotbs1.dbf' size 50M autoextend on next 1M maxsize unlimited
character set ZHS16GBK
/

第六步:
创建数据字典:
执行:catalog.sql catproc.sql catexp.sql

OK 数据库创建完成了

完成后 发现 我的 数据文件 .dbf的 怎么到了db_1/dbs目录下了
下面 进行一次 数据文件迁移,首先
shutdown immediate 然后
startup mount 然后
alter database archivelog 运行归档模式 然后
打开数据库 alter database open;然后
启动归档 archive log start 然后
alter databae begin backup 然后
! cp ....
alter databae end backup
alter system archive log current;

shutdown immediate
startup mount
alter database rename file .. to file
然后 执行介质恢复
reconver database
然后 执行 打开数据库 alter database open
OK了

本文出自 “谦受益” 博客,转载请与作者联系!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: