一个数据库创建多个实例

一个数据库创建多个实例

1.      先要关闭数据库(进程和内存关闭)

[[email protected]_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.      设置环境变量

[[email protected]_2 ~]$ vi .bash_profile

此时环境变量已经设置好了

3.      创建目录

i.             创建相关文件

此时我们可以看见已经有了相关目录,那是我们之前创建的实例ORCL的相关目录

创建目录是采用了批量创建目录{a,b,c,u}dump

[[email protected]_2 ~]$ cd $ORACLE_BASE

[[email protected]_2 oracle]$ ls

admin flash_recovery_area  oradata  oraInventory product

[[email protected]_2 oracle]$

[[email protected]_2 oracle]$ mkdir -p admin/ORA10G/{a,b,c,u}dump

[[email protected]_2 oracle]$ ls

admin flash_recovery_area  oradata  oraInventory product

[[email protected]_2 oracle]$ cd admin/

[[email protected]_2 admin]$ ls

ORA10G  ORCL

[[email protected]_2 admin]$ cd ORA10G/

[[email protected]_2 ORA10G]$ ls

adump bdump  cdump  udump

[[email protected]_2 ORA10G]$

[[email protected]_2 ORA10G]$ ls

adump bdump  cdump  udump

[[email protected]_2 ORA10G]$ cd ..

[[email protected]_2 admin]$ ls

ORA10G  ORCL

[[email protected]_2 admin]$ cd ..

[[email protected]_2 oracle]$ ls

admin flash_recovery_area  oradata  oraInventory product

[[email protected]_2 oracle]$ mkdir -p oradata/ORA10G

[[email protected]_2 oracle]$

ii.             创建密码文件

创建密码文件需要到ORACLE_HOME/dbs目录下创建

[[email protected]_2 10.2.0]$ cd $ORACLE_HOME/dbs

[[email protected]_2 dbs]$ ls

hc_ORCL.dat initdw.ora  init.ora  lkORCL orapwORCL  spfileORCL.ora

[[email protected]_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.

[[email protected]_2 dbs]$ orapwd file=orapwORA10Gpassword=oracle entries=30

[[email protected]_2 dbs]$ ls

hc_ORCL.dat init.ora  orapwORA10G  spfileORCL.ora

initdw.ora  lkORCL    orapwORCL

[[email protected]_2 dbs]$

[[email protected]_2 dbs]$ cat init.ora |grep -v^#|grep -v ^$ >initORA10G.ora

[[email protected]_2 dbs]$ ls

hc_ORCL.dat init.ora        lkORCL       orapwORCL

initdw.ora  initORA10G.ora  orapwORA10G  spfileORCL.ora

[[email protected]_2 dbs]$

[[email protected]_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的数据库

[[email protected]_2 dbs]$ export $ORACLE_SID=ORA10G

[[email protected]_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.

[email protected]>

[email protected]>create spfile from pfile;

File created.

[email protected]>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

[email protected]>

[email protected]>show parameter undo

NAME                                 TYPE        VALUE

------------------------------------ -----------------------------------------

undo_management                      string      MANUAL

undo_retention                       integer     900

undo_tablespace                      string

[email protected]>

修改参数,由于undo_management参数为静态参数,所以需要加上scope=spfile

[email protected]>alter system set undo_management=autoscope=spfile;

System altered.

[email protected]>show parameter undo

NAME                                 TYPE        VALUE

------------------------------------ -----------------------------------------

undo_management                      string      MANUAL

undo_retention                       integer     900

undo_tablespace                      string

[email protected]>shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

此时发现并没有更改,是由于静态参数需要重启才有效

[email protected]>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

[email protected]>

此时只是改了spfile的参数还需要改pfile的参数

[email protected]>create pfile from spfile;

File created.

[email protected]>

5.      多个实例的切换

i.             实例为ORCL启动数据库

[[email protected]_2 dbs]$ export ORACLE_SID=ORCL

[[email protected]_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.

[email protected]>

ii.             实例为ORCL10G启动数据库

[email protected]>exit

Disconnected

[[email protected]_2 dbs]$ export ORACLE_SID=ORA10G

[[email protected]_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

[email protected]>

时间: 2024-08-30 13:42:48

一个数据库创建多个实例的相关文章

数据库名(DB_NAME)、实例名(Instance_name)、以及操作系统环境变量(ORACLE_SID)

数据库名(DB_NAME).实例名(Instance_name).以及操作系统环境变量(ORACLE_SID) 在ORACLE7.8数据库中只有数据库名(db_name)和数据库实例名(instance_name).在ORACLE8i.9i中出现了新的参数,即数据库域名(db_domain).服务名(service_name).以及操作系统环境变量(ORACLE_SID).这些都存在于同一个数据库中的标识,用于区分不同数据库的参数. 一.什么是数据库名(db_name)? 数据库名是用于区分数据

MSSQL为单独数据库创建登录账户

如果要为一个数据库创建一个独立的账号需要这个数据库为包含数据库 当前(非包含)的数据库所面临的问题在描述什么是包含数据库之前,先了解一下为什么会出现包含数据库.当前的数据库有一些问题,如下:1.在数据库迁移或部署的过程中一些信息会丢失     当我们将数据库从一个SQL Server实例迁移到另一个实例是,诸如登陆.工作代理等信息将不能一起被迁移.因为这些信息有特殊用途,自创建后就常驻SQL Server实例.在新的SQL Server实例上重新创建这些任务将是一个耗时.易出错的过程.2.从应用

11gR2RAC环境DBCA创建一个数据库错误ORA-15055 ORA-15001

11gR2RAC环境DBCA创建一个数据库错误ORA-15055 ORA-15001 象: 在11gR2 GridInfrastructure和Database软件安装完毕之后,运行DBCA创建数据库到30%的时候报例如以下错误,点击OK后提示忽略并停止安装. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd3V3ZWlsb25n/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/grav

将oracle冷备份恢复到另外一个数据库实例中

因更换服务器需要将Oracle数据库转移到另外台Oracle中.说明: 1.测试环境为:windows server2003 和 oracle 10g. 2.2台服务器安装的程序目录一样,数据目录不一样.特别借签了Afshen兄弟发的实践将oracle冷备份恢复到另外一个数据库实例中操作文章.但是对于新手来说没有详细说明,且我的操作有点点差异.另外我是新手,只知道工作完成,但是不知道是否此操作是否对于数据库使用存在何影响,还需要后期开发使用在知道,希望能给大家提供对比作为操作中的参考.(因时间仓

如何将RAC数据库的 RMAN Disk 备份 Restore 到另一个节点上的单个实例 (Doc ID 415579.1)

HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another Node (Doc ID 415579.1) APPLIES TO: Oracle Database - Enterprise Edition - Version 9.2.0.1 and laterOracle Database Cloud Schema Service - Version N/A and laterOracle Databa

Linux下Oracle数据库创建新实例

本人太懒,觉得重要记录一下. 拿到一份源码,高度依赖数据库,实在不想用oracl实例,故新建一个实例. 几个比较重要的系统参数:ORACLE_HOME,ORACLE_BASE. 1.新增实例信息 cd $ORACLE_HOME/dbs init.ora # 实例配置文件 可以自己复制一个,命名规则:initSID.ora 这个文件initSID.ora主要修改红框的部分(没啥追求,能创建成功就行,具体另说) 文件修改完成后,在ORACLE_BASE/admin目录下,创建一个与SID一致的目录,

PostgreSQL创建一个数据库

看看你能否访问数据库服务器的第一个例子就是试着创建一个数据库.一台运行着的 PostgreSQL 服务器可以管理许多数据库.通常我们会为每个项目和每个用户单独使用一个数据库. 节点管理员可能已经为你创建了可以使用的数据库.他应该已经告诉你这个数据库的名字.如果这样你就可以省略这一步,并且跳到下一节. 要创建一个新的数据库(在我们这个例子里叫 mydb),你可以使用下面的命令: $ createdb mydb 它应该生成下面这样的响应: CREATE DATABASE 如果这样,那么这一步就成功了

12C RAC中的一个数据库实例自动crash并报ORA-27157、ORA-27300等错误

rhel7.2上安装12C RAC数据库后,其中一个数据库实例经常会自动crash.查看alert日志发现以下错误信息: Errors in file /d12/app/oracle/diag/rdbms/rac12c/rac12c2/trace/rac12c2_j000_21047.trc: ORA-27157: OS post/wait facility removed ORA-27300: OS system dependent operation:semop failed with st

课后作业11--使用SQL语句创建一个数据库

use master if db_id ('test') is not null--判断test数据库是否存在 drop database [test]--如果存在 删除test go--完成查找删除工作 /*****创建一个数据库****/ create database [test]--创建数据库test on primary ( name = 'test_data',--数据文件的逻辑名称 filename = 'd:\documents\mssql\data\test_data.mdf'