新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这篇文章给大家介绍oracle 11g如何进行手工建库,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
成都创新互联公司专注于临邑企业网站建设,响应式网站建设,成都做商城网站。临邑网站建设公司,为临邑等地区提供建站服务。全流程按需求定制设计,专业设计,全程项目跟踪,成都创新互联公司专业和态度为您提供的服务工作环境: ORE 6.5
手工建库是作为dba必须掌握的一个基本技能,它使清楚的认识oracle的目录结构、oracle所必需的文件、理解表空间、认证方式等概念。
1.设置环境变量
[oracle@ENMOEDU ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=ENMOEDU
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libi
~
~
~
~
".bash_profile" [readonly] 19L, 385C 1,1 All
[oracle@ENMOEDU ~]$ source .bash_profile
2.准备密码文件及初始化参数文件和创建数据库脚本
[oracle@ENMOEDU ~]$ cd $ORACLE_BASE
[oracle@ENMOEDU oracle]$ ls
cfgtoollogs checkpoints diag product
[oracle@ENMOEDU oracle]$ cd $ORACLE_HOME/dbs
[oracle@ENMOEDU dbs]$ ls
init.ora
[oracle@ENMOEDU dbs]$ orapwd file=orapwdENMOEDU password=oracle entries=30
[oracle@ENMOEDU dbs]$ cat init.ora|grep -v ^$|grep -v ^# >initENMOEDU.ora
[oracle@ENMOEDU dbs]$ vi initENMOEDU.ora
diagnostic_dest='/u01/app/oracle'
db_name='ENMOEDU'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/ENMOEDU/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = (/u01/app/oracle/oradata/ENMOEDU/control01.ctl,/u01/app/oracle/oradata/ENMOEDU/control02.ctl)
compatible ='11.2.0'
~
~
~
~
~
~
~
"initENMOEDU.ora" 15L, 493C written
3.准备创建数据库需要的相关目录
[oracle@ENMOEDU oracle]$ cd /u01/app/oracle/
[oracle@ENMOEDU oracle]$ mkdir -p admin/ENMOEDU/audmp
[oracle@ENMOEDU oracle]$ mkdir -p flash_recovery_area
[oracle@ENMOEDU oracle]$ ls
admin cfgtoollogs checkpoints diag flash_recovery_area product
4.开始手工建库
[oracle@ENMOEDU ENMOEDU]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 10 00:39:10 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1071333376 bytes
Fixed Size 1349732 bytes
Variable Size 620758940 bytes
Database Buffers 444596224 bytes
Redo Buffers 4628480 bytes
[oracle@ENMOEDU ~]$ vi create_db.sql
CREATE DATABASE ENMOEDU
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ENMOEDU/redo01a.log','/u01/app/oracle/oradata/ENMOEDU/redo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/ENMOEDU/redo02a.log','/u01/app/oracle/oradata/ENMOEDU/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/ENMOEDU/redo03a.log','/u01/app/oracle/oradata/ENMOEDU/redo03b.log') SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/ENMOEDU/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/ENMOEDU/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/ENMOEDU/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/ENMOEDU/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/ENMOEDU/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
"create_db.sql" 24L, 1237C written
[oracle@ENMOEDU ~]$ cd /u01/app/oracle
[oracle@ENMOEDU oracle]$ ls
admin cfgtoollogs checkpoints diag flash_recovery_area product
[oracle@ENMOEDU oracle]$ mkdir -p oradata/ENMOEDU
[oracle@ENMOEDU oracle]$ cd /u01/app/oracle/diag/rdbms/enmoedu/ENMOEDU/trace/
[oracle@ENMOEDU trace]$ tail -100f alert_ENMOEDU.log
SQL> @/home/oracle/create_db.sql
Database created.
SQL>@?/rdbms/admin/catalog.sql
......
PL/SQL procedure successfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP CATALOG 2014-02-10 01:12:14
SQL> @?/rdbms/admin/catproc.sql
......
SQL>
SQL> SELECT dbms_registry_sys.time_stamp('CATPROC') AS timestamp FROM DUAL;
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP CATPROC 2014-02-10 01:25:21
1 row selected.
SQL>
SQL> SET SERVEROUTPUT OFF
SQL>
SQL>
SQL> select status from v$instance;
STATUS
------------
OPEN
1 row selected.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ENMOEDU ENMOEDU]$
5.完成手工建库
关于oracle 11g如何进行手工建库就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。