oracle06_手动建库

--1.建目录
	$ cd $ORACLE_BASE
	$ mkdir oradata/DB
	$ mkdir admin/DB
	$ mkdir admin/DB/{a,b,c,u}dump

--2.口令文件&参数文件
	$ orapwd file=$ORACLE_HOME/dbs/orapwDB  password=oracle

	$ vim $ORACLE_HOME/dbs/initDB.ora
	db_name=db
	instance_name=DB
	sga_max_size=500m
	sga_target=300m
	job_queue_processes=10
	background_dump_dest='/oracle/admin/DB/bdump'
	core_dump_dest='/oracle/admin/DB/cdump'
	user_dump_dest='/oracle/admin/DB/udump'
	control_files='/oracle/oradata/DB/control01.ctl','/oracle/oradata/DB/control02.ctl'
	#compatible=10.2.0.1
	undo_tablespace=undotbs1
	undo_management=auto

	创建spfile
	$ export ORACLE_SID=DB
	$ sql / as sysdba
	SQL> startup nomount
	SQL> create spfile from pfile;

--3.创建数据库,编写建库脚本:
	$ vim createdb.sql
create database db
maxinstances 2
maxdatafiles 200
maxlogfiles 120
maxlogmembers 5
maxloghistory  290
user sys identified by oracle
user system identified by oracle
character set utf8
national character set al16utf16
datafile '/oracle/oradata/DB/system01.dbf' size 500m autoextend on
sysaux datafile '/oracle/oradata/DB/sysaux01.dbf'  size 200m
undo tablespace undotbs1 datafile '/oracle/oradata/DB/undotbs1.dbf' size 200m
default temporary tablespace temp1  tempfile '/oracle/oradata/DB/temp01.dbf' size 100m
logfile
group 1 '/oracle/oradata/DB/redo01.log' size 100m,
group 2 '/oracle/oradata/DB/redo02.log' size 100m
/

运行脚本建库:
	$ sql / as sysdba
	SQL> @createdb.sql

--4.配置监听
$ vim $ORACLE_HOME/network/admin/listener.ora 
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = db)
      (ORACLE_HOME = /oracle/product/10g)
      (SID_NAME = DB)
    )
  )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = liufang.founder.com)(PORT = 1522))
    )
  )


$ vim $ORACLE_HOME/network/admin/tnsnames.ora 
DB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.128)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = DB)
    )
  )

--5.安装最基本的数据字典
	$ sql / as sysdba
	@?/rdbms/admin/catalog.sql
	@?/rdbms/admin/catproc.sql
	conn system/oracle
	@?/sqlplus/admin/pupbld.sql

--6.开启归档和闪回
	show parameter reten,reco  -> 设定 大小,路径  
	alter database archivelog, flashback on, open ->先开归档再开闪回


--7.启动闪回功能(选做):

设置闪回大小 : alter system set db_recovery_file_dest_size=1g;                              
设置闪回路径 : alter system set db_recovery_file_dest='/oracle/flash_recovery_area/'; 
库重启mount : startup force mount
开归档  : alter database archivelog;
开闪回  : alter database flashback on;
开数据库 : alter database open;

 
阅读更多
个人分类: oracle学习笔记
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭