一个数据库创建多个实例
2014-09-10 14:23
357 查看
一个数据库创建多个实例
1. 先要关闭数据库(进程和内存关闭)[oracle@oracle_2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on TueNov 12 20:34:53 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
2. 设置环境变量
[oracle@oracle_2 ~]$ vi .bash_profile
此时环境变量已经设置好了
3. 创建目录
i. 创建相关文件
此时我们可以看见已经有了相关目录,那是我们之前创建的实例ORCL的相关目录
创建目录是采用了批量创建目录{a,b,c,u}dump
[oracle@oracle_2 ~]$ cd $ORACLE_BASE
[oracle@oracle_2 oracle]$ ls
admin flash_recovery_area oradata oraInventory product
[oracle@oracle_2 oracle]$
[oracle@oracle_2 oracle]$ mkdir -p admin/ORA10G/{a,b,c,u}dump
[oracle@oracle_2 oracle]$ ls
admin flash_recovery_area oradata oraInventory product
[oracle@oracle_2 oracle]$ cd admin/
[oracle@oracle_2 admin]$ ls
ORA10G ORCL
[oracle@oracle_2 admin]$ cd ORA10G/
[oracle@oracle_2 ORA10G]$ ls
adump bdump cdump udump
[oracle@oracle_2 ORA10G]$
[oracle@oracle_2 ORA10G]$ ls
adump bdump cdump udump
[oracle@oracle_2 ORA10G]$ cd ..
[oracle@oracle_2 admin]$ ls
ORA10G ORCL
[oracle@oracle_2 admin]$ cd ..
[oracle@oracle_2 oracle]$ ls
admin flash_recovery_area oradata oraInventory product
[oracle@oracle_2 oracle]$ mkdir -p oradata/ORA10G
[oracle@oracle_2 oracle]$
ii. 创建密码文件
创建密码文件需要到ORACLE_HOME/dbs目录下创建
[oracle@oracle_2 10.2.0]$ cd $ORACLE_HOME/dbs
[oracle@oracle_2 dbs]$ ls
hc_ORCL.dat initdw.ora init.ora lkORCL orapwORCL spfileORCL.ora
[oracle@oracle_2 dbs]$ orapwd
Usage: orapwd file=<fname>password=<password> entries=<users> force=<y/n>
where
file -name of password file (mand),
password- password for SYS (mand),
entries -maximum number of distinct DBA and force - whether to overwrite existing file (opt),
OPERs (opt),
There areno spaces around the equal-to (=) character.
[oracle@oracle_2 dbs]$ orapwd file=orapwORA10Gpassword=oracle entries=30
[oracle@oracle_2 dbs]$ ls
hc_ORCL.dat init.ora orapwORA10G spfileORCL.ora
initdw.ora lkORCL orapwORCL
[oracle@oracle_2 dbs]$
[oracle@oracle_2 dbs]$ cat init.ora |grep -v^#|grep -v ^$ >initORA10G.ora
[oracle@oracle_2 dbs]$ ls
hc_ORCL.dat init.ora lkORCL orapwORCL
initdw.ora initORA10G.ora orapwORA10G spfileORCL.ora
[oracle@oracle_2 dbs]$
[oracle@oracle_2 dbs]$ vi initORA10G.ora
将内容改的和下面的一样
db_name=ORA10G
db_files = 80 # SMALL
db_file_multiblock_read_count = 8 #SMALL
log_checkpoint_interval = 10000
processes = 50 # SMALL
parallel_max_servers = 5 #SMALL
log_buffer = 32768 # SMALL
max_dump_file_size = 10240 # limit trace file size to 5 Meg each
global_names = false
control_files =(/u01/app/oracle/oradata/ORA10G/ora_control1.ctl,/u01/app/oracle/oradata/ORA10G/ora_control2.ctl)
sga_max_size=300m
sga_target=300m
4. 启动实例为ORA10G的数据库
[oracle@oracle_2 dbs]$ export $ORACLE_SID=ORA10G
[oracle@oracle_2 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on TueNov 12 21:08:55 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SYS@ORA10G>
SYS@ORA10G>create spfile from pfile;
File created.
SYS@ORA10G>startup nomount;
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 1219184 bytes
Variable Size 96470416 bytes
Database Buffers 213909504 bytes
Redo Buffers 2973696 bytes
SYS@ORA10G>
SYS@ORA10G>show parameter undo
NAME TYPE VALUE
------------------------------------ -----------------------------------------
undo_management string MANUAL
undo_retention integer 900
undo_tablespace string
SYS@ORA10G>
修改参数,由于undo_management参数为静态参数,所以需要加上scope=spfile
SYS@ORA10G>alter system set undo_management=autoscope=spfile;
System altered.
SYS@ORA10G>show parameter undo
NAME TYPE VALUE
------------------------------------ -----------------------------------------
undo_management string MANUAL
undo_retention integer 900
undo_tablespace string
SYS@ORA10G>shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
此时发现并没有更改,是由于静态参数需要重启才有效
SYS@ORA10G>startup nomount;
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 1219184 bytes
Variable Size 96470416 bytes
Database Buffers 213909504 bytes
Redo Buffers 2973696 bytes
SYS@ORA10G>
此时只是改了spfile的参数还需要改pfile的参数
SYS@ORA10G>create pfile from spfile;
File created.
SYS@ORA10G>
5. 多个实例的切换
i. 实例为ORCL启动数据库
[oracle@oracle_2 dbs]$ export ORACLE_SID=ORCL
[oracle@oracle_2 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on TueNov 12 21:19:19 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SYS@ORCL>
ii. 实例为ORCL10G启动数据库
SYS@ORCL>exit
Disconnected
[oracle@oracle_2 dbs]$ export ORACLE_SID=ORA10G
[oracle@oracle_2 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on TueNov 12 21:24:54 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SYS@ORA10G>
相关文章推荐
- 一个oracle 数据库创建多个实例
- oracle 如何在一个数据库创建多个实例
- oracle创建多个数据库实例及其管理
- 一个创建数据库(包括用户、bufferpool、tablespace等)的完整实例
- 一个oracle 用户下面创建多个实例
- Silverlight实用窍门系列:30.Silverlight中创建一个最简单的WCF RIA Services访问数据库实例【实例源码+数据库下载】
- 同一个数据库实例,不同用户下多表创建视图,Hibernate完成ORM映射,Spring整合,后台实现
- 从桌面图标启动一个LauncherMode为标准模式的主activity为什么不会重复创建多个实例
- 在同一个Session中重复创建多个地理数据库
- 手工创建数据库(新建一个实例,在同一个数据库上跑两个实例)
- 1.说说你个人理解的存储解决方案的发展趋势,作图描述。 11.png 2.画一张说明ASM实例同数据库实例协同工作的原理图,并给出语言描述。 14.png 一个监听器可以为多个实例
- 最简单直接继承、扩展Object,或者克隆一个Object到能创建多个互不干扰实例的方法
- 在LINUX平台上手动创建数据库(oracle 10g)(在一个oracle服务器上启动两个实例)
- ADO 实例《创建一个临时数据库 创建一个临时数据表 GridView1绑定内容 以及Dataset_的使用》
- 一个oracle 用户下面创建多个实例
- 下面创建一个链接数据库的开发实例
- oracle随记——用sqlplus创建一个数据库实例
- 30.Silverlight中创建一个最简单的WCF RIA Services访问数据库实例
- 最简单直接继承、扩展Object,或者克隆一个Object到能创建多个互不干扰实例的方法
- 一个创建多个线程的实例