Oracle 10g 手工建库

以前在听播布客小布老师视频的时候,学习了手工建库, oacle 创建数据库一般都是使用dbca ,通过脚本建库给自己在创建数据库上多了一种选择。

手工建库步骤

  1. Choose a unique instance and database name
  2. Choose a database character set
  3. Set a operating system variable
  4. Create the initialization parameter file
  5. Start the instance in NOMOUNT stage
  6. Create and Excetue the CREATE DATABASE commond
  7. Run scripts to generate the data dictionary and accomplish post-creation setps
  8. Create addtitional tablespaces as needed

1 ) CHOOSE A UNIQUE SID AND DATABASE CHARACTER 和相关目录

1
2
3
4
*.db_name='MANUA' CHARACTER SET ZHS16GBK NATIONAL CHARACTER SET AL16UTF16
mkdir /oradata/MANUAL
mkdir $ORACLE_BASE/admin/MANUA
cd MANUA mkdir adump bdump cdump dpdump pfile udump

2 ) 用orapwd命令创建密码文件

1
orapwd file=$ORACLE_HOME/dbs/orapwMANUA password=MANUA20 entries=10

注意:需要创建密码文件,否则只能通过操作系统论证,远程Oracle客户端不能连接.

3) 准备环境变量
以下五个为常用

1
2
3
4
5
6
exprt ORACLE_BASE=/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10g
export ORACLE_SID=MANUA
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

4) 准备初始化参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[oracle@standby dbs]$ cat initMANUA.ora
*.audit_file_dest='/app/oracle/admin/MANUA/adump'
*.background_dump_dest='/app/oracle/admin/MANUA/bdump'
#*.compatible='10.2.0.3.0'
*.control_files='/oradata/MANUA/control01.ctl','/oradata/MANUA/control02.ctl','/oradata/MANUA/control03.ctl'
*.core_dump_dest='/app/oracle/admin/MANUA/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='MANUA'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=MANUAXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=103936000
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_max_size=251225472
*.sga_target=221225472
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/app/oracle/admin/MANUA/udump'

5) 创建数据库
如果是WINDOWS,用以下命令创建或者删除服务

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
oradim -NEW -SID monitor1
oradim -DELETE -SID OSS
Startup nomount;

--create database sql
CREATE DATABASE CMTT81
CONTROLFILE REUSE
USER SYS IDENTIFIED BY CMTT81155
USER SYSTEM IDENTIFIED BY CMTT81155
LOGFILE GROUP 1 ('/dev/vg01/rlvredolog11', '/dev/vg01/rlvredolog12') SIZE 512M,
GROUP 2 ('/dev/vg01/rlvredolog21', '/dev/vg01/rlvredolog22') SIZE 512M,
GROUP 3 ('/dev/vg01/rlvredolog31', '/dev/vg01/rlvredolog32') SIZE 512M,
GROUP 4 ('/dev/vg01/rlvredolog41', '/dev/vg01/rlvredolog42') SIZE 512M,
GROUP 5 ('/dev/vg01/rlvredolog51', '/dev/vg01/rlvredolog52') SIZE 512M,
GROUP 6 ('/dev/vg01/rlvredolog61', '/dev/vg01/rlvredolog62') SIZE 512M
MAXLOGFILES 6
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 1000
MAXINSTANCES 1
CHARACTER SET UTF8
NATIONAL CHARACTER SET UTF8
DATAFILE '/dev/vg01/rCMTT81_system_01.dbf' SIZE 3130M AUTOEXTEND OFF
SYSAUX DATAFILE '/dev/vg01/rCMTT81_sysaux_01.dbf' SIZE 3130M AUTOEXTEND OFF
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/dev/vg01/rCMTT81_temp_01.dbf'
SIZE 5140M AUTOEXTEND OFF
UNDO TABLESPACE UNDOTBS1
DATAFILE '/dev/vg01/rCMTT81_undo_01.dbf'
SIZE 10240M AUTOEXTEND OFF;

6) 导入数据字典

1
2
3
@?/rdbms/admin/catalog.sql;
@?/rdbms/admin/catproc.sql;
@?/sqlplus/admin/pupbld.sql; --system 用户执行

Oracle 10g 手工建库

附一:查自动扩展

1
2
3
4
5
6
7
col file_name format a50;
alter database datafile 1 autoextend off;
alter database datafile 2 autoextend off;
alter database datafile 3 autoextend off;
alter database tempfile 1 autoextend off;
select file_name,file_id,autoextensible ,bytes/(1024*1024*1024)G from dba_data_files where autoextensible='YES';
select file_name,file_id,autoextensible,bytes/(1024*1024*1024)G From dba_temp_files;

附二:手工建库DBCA找不到解决方法

vi /etc/oratab
加入你手工创建的数据:形如:

1
MANUA :/app/oracle/product/10g:N

然后在运行dbca就能看到了!

原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/tech/database/236352.html

(0)
上一篇 2022年1月24日 21:27
下一篇 2022年1月24日 21:27

相关推荐

发表回复

登录后才能评论