码迷,mamicode.com
首页 > 数据库 > 详细

Oracle11gR2--手工建库&dbca建库

时间:2018-04-03 14:34:49      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:sid   2.7   xtend   variable   use   rar   copy   ted   history   

1 Oracle11gR2 dbca建库

[oracle@localhost ~]$ cd $ORACLE_BASE/database

[oracle@localhost database]$ dbca -silent -createDatabase -templateName $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc -gdbname orcl -sid orcl -characterSet ZHS16GBK  
Enter SYS user password:   

Enter SYSTEM user password:   

Copying database files  
1% complete  
3% complete  
11% complete  
18% complete  
26% complete  
37% complete  
Creating and starting Oracle instance  
40% complete  
45% complete  
50% complete  
55% complete  
56% complete  
60% complete  
62% complete  
Completing Database Creation  
66% complete  
70% complete  
73% complete  
85% complete  
96% complete  
100% complete  
Look at the log file "/home/oracle/app/cfgtoollogs/dbca/orcl/orcl.log" for further details.  

2 Oracle11gR2手工建库

2.1.指定Oracle SID

[oracle@localhost ~]$ echo $ORACLE_SID  
orcl 
 

2.2.设置环境变量

[oracle@localhost ~]$ echo $ORACLE_HOME  
/home/oracle/app/oracle/product/11.2.0/dbhome_1  
[oracle@localhost ~]$ echo $ORACLE_BASE  
/home/oracle/app   
由于这些参数已经在安装oracle软件的时候写入了环境变量,这里就不再修改

2.3.选择认证方式,创建密码文件

[oracle@localhost ~]$ cd $ORACLE_HOME/dbs  
[oracle@localhost dbs]$ orapwd file=/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapworcl entries=30  

Enter password for SYS:   

2.4.创建参数文件

[oracle@localhost ~]$ cd $ORACLE_HOME/dbs
[oracle@localhost dbs]$ cp init.ora initorcl.ora  
[oracle@localhost dbs]$ ls  
init.ora  initorcl.ora  orapworcl  
[oracle@localhost dbs]$ vim initorcl.ora  

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at  
# install time)  

db_name='ORCL'  
memory_target=900m  
processes = 150  
audit_file_dest='/home/oracle/app/admin/orcl/adump'  
audit_trail ='db'  
db_block_size=8192  
db_domain=''  
db_recovery_file_dest='/home/oracle/app/flash_recovery_area'  
db_recovery_file_dest_size=2G  
diagnostic_dest='/home/oracle/app'  
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'  
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 = ('/home/oracle/app/oradata/orcl/control01.ctl', '/home/oracle/app/oradata/orcl/control02.ctl')  
compatible ='11.2.0'  
"initorcl.ora" 66L, 2856C written      

#注:需要根据参数文件中的参数创建相应的目录,创建后重新赋一次权限


[root@localhost ~]# mkdir -p /home/oracle/app/admin/orcl/adump  
[root@localhost ~]# mkdir -p /home/oracle/app/flash_recovery_area  
[root@localhost oradata]$ mkdir -p /home/oracle/app /oradata/orcl  
[root@localhost ~]# chown -R oracle:oinstall /home/oracle/app/  
[root@localhost ~]# chmod -R 775 /home/oracle/app/  

2.5.连接到数据库,启动到nomount状态

[oracle@localhost ~]$ cd $ORACLE_HOME/dbs
[oracle@localhost dbs]$ sqlplus / as sysdba    
SQL*Plus: Release 11.2.0.4.0 Production on Sat Nov 19 02:09:58 2016    
Copyright (c) 1982, 2013, Oracle.  All rights reserved.    
Connected to an idle instance.  

SQL> startup nomount  
ORACLE instance started.  

Total System Global Area  939495424 bytes  
Fixed Size                  2258840 bytes  
Variable Size             595593320 bytes  
Database Buffers          335544320 bytes  
Redo Buffers        

2.6. 执行建库脚本

SQL> CREATE DATABASE orcl  
  2     USER SYS IDENTIFIED BY oracle  
  3     USER SYSTEM IDENTIFIED BY oracle  
  4     LOGFILE GROUP 1 ('/home/oracle/app/oradata/orcl/redo01a.log','/home/oracle/app/oradata/orcl/redo01b.log') SIZE 100M BLOCKSIZE 512,  
  5             GROUP 2 ('/home/oracle/app/oradata/orcl/redo02a.log','/home/oracle/app/oradata/orcl/redo02b.log') SIZE 100M BLOCKSIZE 512,  
  6             GROUP 3 ('/home/oracle/app/oradata/orcl/redo03a.log','/home/oracle/app/oradata/orcl/redo03b.log') SIZE 100M BLOCKSIZE 512  
  7     MAXLOGFILES 5  
  8     MAXLOGMEMBERS 5  
  9     MAXLOGHISTORY 1  
 10     MAXDATAFILES 100  
 11     CHARACTER SET ZHS16GBK  
 12     NATIONAL CHARACTER SET AL16UTF16  
 13     EXTENT MANAGEMENT LOCAL  
 14     DATAFILE '/home/oracle/app/oradata/orcl/system01.dbf' SIZE 325M REUSE  
 15     SYSAUX DATAFILE '/home/oracle/app/oradata/orcl/sysaux01.dbf' SIZE 325M REUSE  
 16     DEFAULT TABLESPACE users  
 17        DATAFILE '/home/oracle/app/oradata/orcl/users01.dbf'  
 18        SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED  
 19     DEFAULT TEMPORARY TABLESPACE temp  
 20        TEMPFILE '/home/oracle/app/oradata/orcl/temp01.dbf'  
 21        SIZE 20M REUSE  
 22     UNDO TABLESPACE UNDOTBS1  
 23        DATAFILE '/home/oracle/app/oradata/orcl/undotbs01.dbf'  
 24        SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;  

Database created.  

2.7. 执行创建数据字典脚本

@?/rdbms/admin/catalog.sql  
@?/rdbms/admin/catproc.sql  
@?/sqlplus/admin/pupbld.sql #需使用system用户执行

Oracle11gR2--手工建库&dbca建库

标签:sid   2.7   xtend   variable   use   rar   copy   ted   history   

原文地址:https://www.cnblogs.com/chinesern/p/8707729.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!