Existing instances Oracle under new instance

Source: Internet
Author: User
Tags sessions

It is divided into 5 main steps: Create an instance directory, create a password file, create a parameter file, create a library script and build a library, and create a data dictionary .

Of these, special attention needs to be paid to 2 points:

    • The permissions of the directory, that is, the user and the owning user group are Oracle. You can switch to an existing Oracle user or create it as root and then empower it.
    • Specifies the encoding when the instance is created.

Here's an example of Oracle 10.2.0.1.0 to start creating:

Description

    • There is already a functioning Oracle instance CMS on this server, boot from boot, and a listener.
    • There is already a user Oracle, the owning user group Oinstall.
    • ORACLE Environment variables: oracle_sid=cms Oracle_base=/oracle/app
    • The newly created instance is called MyDB

1 Switch to the Oracle user and create the instance directory that is required by the Oracle process to experience errors or user manual trace or data storage:

Note: The red place below must be the name of the instance you want to create. 】

[Email protected] ~]# su-oracle

[Email protected] oradata]$ Oracle_sid=mydb
[Email protected] oradata]$ export ORACLE_SID
[Email protected] oradata]$ echo $ORACLE _sid

[Email protected] oradata]$ mydb

[Email protected] oradata]$ mkdir-p $ORACLE _base/admin/mydb/adump;mkdir-p $ORACLE _base/admin/mydb/bdump;
[Email protected] oradata]$ mkdir-p $ORACLE _base/admin/mydb/cdump;mkdir-p $ORACLE _base/admin/mydb/udump;
[Email protected] oradata]$ mkdir-p $ORACLE _base/admin/mydb/pfile;mkdir-p $ORACLE _base/oradata/mydb;

2 Create the password file, the red place is the name of the password file, the rule is the orapw+ instance name, this is orapwmydb:

Note: It is possible that different versions of the password file are located in different locations, find the DBS directory, and see if there are already existing instances of the password file. in this example, the DBS directory has orapwcms files. "

[Email protected] oradata]$ orapwd file= $ORACLE _base/product/10.2.0/db_1/dbs/orapwmydb password=turboblog Entries=5 Force=y

3 Create the. ora parameter file, located in the same directory as in step 2nd. The file name rule is the init+ instance name, and this is Initmydb.ora. Copy the parameter file of an existing instance to modify it.

For example, there is already a parameter file for an existing instance in this directory, which is Initcms.ora.

[Email protected] oradata]$ CD $ORACLE _base/product/10.2.0/db_1/dbs/
[email protected] dbs]$ CP Initcms.ora Initmydb.ora

Modify the contents of the file, note that the red place needs to be modified to our newly created instance name MyDB.

Note: These directories are already built in the first step and should all be present. The value of Undo_tablespace needs to be remembered, when creating a DB instance you need to use "

The contents of the original document are as follows:

##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################

###########################################
# Cache and I/O
###########################################
db_block_size=8192
Db_file_multiblock_read_count=16

###########################################
# Cursors and Library Cache
###########################################
open_cursors=300

###########################################
# Database Identification
###########################################
Db_domain= ""
Db_name=CMS

###########################################
# Diagnostics and Statistics
###########################################
background_dump_dest=/oracle/app/admin/Cms/bdump
core_dump_dest=/oracle/app/admin/Cms/cdump
user_dump_dest=/oracle/app/admin/Cms/udump

###########################################
# File Configuration
###########################################
Control_files= ("/oracle/app/oradata/cms/control01.ctl", "/oracle/app/oradata/cms/control02.ctl", "/ oracle/app/oradata/Cms/control03.ctl ")
Db_recovery_file_dest=/oracle/app/flash_recovery_area
db_recovery_file_dest_size=2147483648

###########################################
# Job Queues
###########################################
job_queue_processes=10

###########################################
# Miscellaneous
###########################################
compatible=10.2.0.1.0

###########################################
# Network Registration
###########################################
# #local_listener =listener_CMS

###########################################
# Processes and Sessions
###########################################
processes=150

###########################################
# SGA Memory
###########################################
sga_target=605028352

###########################################
# Security and Auditing
###########################################
audit_file_dest=/oracle/app/admin/Cms/adump
Remote_login_passwordfile=exclusive

###########################################
# Shared Server
###########################################
Dispatchers= "(protocol=tcp) (service=cmsXDB)"

###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=201326592

###########################################
# System Managed Undo and Rollback segments
###########################################
Undo_management=auto
undo_tablespace=UNDOTBS1

The following changes are followed:

[Email protected] dbs]$ more Initmydb.ora
##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################

###########################################
# Cache and I/O
###########################################
db_block_size=8192
Db_file_multiblock_read_count=16

###########################################
# Cursors and Library Cache
###########################################
open_cursors=300

###########################################
# Database Identification
###########################################
Db_domain= ""
Db_name=mydb

###########################################
# Diagnostics and Statistics
###########################################
Background_dump_dest=/oracle/app/admin/mydb/bdump
Core_dump_dest=/oracle/app/admin/mydb/cdump
User_dump_dest=/oracle/app/admin/mydb/udump

###########################################
# File Configuration
###########################################
control_files= ("/oracle/app/oradata/mydb/control01.ctl", "/oracle/app/oradata/mydb/control02.ctl", "/oracle/app/ Oradata/mydb/control03.ctl ")
Db_recovery_file_dest=/oracle/app/flash_recovery_area
db_recovery_file_dest_size=2147483648

###########################################
# Job Queues
###########################################
job_queue_processes=10

###########################################
# Miscellaneous
###########################################
compatible=10.2.0.1.0

###########################################
# Network Registration
###########################################
# #local_listener =listener_blog

###########################################
# Processes and Sessions
###########################################
processes=150

###########################################
# SGA Memory
###########################################
sga_target=605028352

###########################################
# Security and Auditing
###########################################
Audit_file_dest=/oracle/app/admin/mydb/adump
Remote_login_passwordfile=exclusive

###########################################
# Shared Server
###########################################
Dispatchers= "(protocol=tcp) (SERVICE=MYDBXDB)"

###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=201326592

###########################################
# System Managed Undo and Rollback segments
###########################################
Undo_management=auto
Undo_tablespace=undotbs3

4 Create a Build library script:

CREATE DATABASE MyDB
Controlfile Reuse
LOGFILE GROUP 1 ('/oracle/app/oradata/mydb/redo01.log ') SIZE 10M reuse,
GROUP 2 ('/oracle/app/oradata/mydb/redo02.log ') SIZE 10M reuse,
GROUP 3 ('/oracle/app/oradata/mydb/redo03.log ') SIZE 10M reuse
DataFile '/oracle/app/oradata/mydb/system01.dbf ' SIZE 500M
EXTENT MANAGEMENT LOCAL
Sysaux datafile '/oracle/app/oradata/mydb/sysaux01.dbf ' size 120M reuse autoextend on next 10240K MaxSize Unlimited
UNDO tablespace UNDOTBS3 datafile '/oracle/app/oradata/mydb/undotbs01.dbf ' SIZE 500M
DEFAULT Temporary tablespace TEMP
Tempfile '/oracle/app/oradata/mydb/temp01.dbf ' SIZE 500M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 10M
Noarchivelog
Maxdatafiles 1000
CHARACTER SET UTF8
National CHARACTER SET UTF8
Maxlogfiles 10;

Create a database, pay attention to the Red font file path, and also have the database encoding:
[Email protected] ~]$ sqlplus "/as sysdba"


sql> SHUTDOWN Immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sql> startup Nomount pfile=/Oracle/app/product/10.2.0/db_1/dbs/initmydb.ora
ORACLE instance started.

Total System Global area 608174080 bytes
Fixed Size 1220820 bytes
Variable Size 163581740 bytes
Database buffers 436207616 bytes
Redo buffers 7163904 bytes
sql> CREATE DATABASE MyDB
2 Controlfile Reuse
3 LOGFILE GROUP 1 ('/oracle/app/oradata/Mydb/redo01.log ') SIZE 10M reuse,
4 GROUP 2 ('/oracle/app/oradata/Mydb/redo02.log ') SIZE 10M reuse,
5 GROUP 3 ('/oracle/app/oradata/Mydb/redo03.log ') SIZE 10M reuse
6 datafile '/oracle/app/oradata/MYDB/SYSTEM01.DBF ' SIZE 500M
7 EXTENT MANAGEMENT LOCAL
8 Sysaux datafile '/oracle/app/oradata/MYDB/SYSAUX01.DBF ' size 120M reuse autoextend on next 10240K MaxSize Unlimited
9 UNDO tablespace UNDOTBS3 datafile '/oracle/app/oradata/mydb/undotbs01.dbf ' SIZE 500M
Ten DEFAULT temporary tablespace TEMP
Tempfile '/oracle/app/oradata/mydb/temp01.dbf ' SIZE 500M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 10M
Noarchivelog
1000 Maxdatafiles
CHARACTER SET UTF8
National CHARACTER SET UTF8
maxlogfiles;

Database created.

5 Create a data dictionary:

Sql> @?/rdbms/admin/catalog.sql;

Sql> @?/rdbms/admin/catproc.sql;

Sql> @?/sqlplus/admin/pupbld.sql;

6 Start the database to ensure that the current instance is a new instance:

sql>exit;

[Email protected] ~]$ Oracle_sid=mydb
[Email protected] ~]$ export ORACLE_SID
[Email protected] ~]$ echo $ORACLE _sid

MyDB

sql> startup force;
ORACLE instance started.

Total System Global area 608174080 bytes
Fixed Size 1220820 bytes
Variable Size 167776044 bytes
Database buffers 432013312 bytes
Redo buffers 7163904 bytes
Database mounted.
Database opened.

Log in with the System account, view the default user, and the default password is manager:

Sql> Conn System/manager;
Connected.
Sql> select username from all_users;

USERNAME
------------------------------
Dbsnmp
Tsmsys
DIP
Outln
SYSTEM
SYS

6 rows selected.

==================================================================================

At this point, a new Oracle instance has been added, and many times we need all the instances to boot from, we need to make the following modifications:
Add the following line
[Email protected] oracle]# Vi/etc/oratab

Cms:/oracle/app/product/10.2.0/db_1:y
Mydb:/oracle/app/product/10.2.0/db_1:y

Then copy one:
[Email protected] oracle]# Cp/etc/oratab/var/opt/oracle/oratab

To restart the server:

[email protected] oracle]# reboot

If a remote link is required, this instance can be added to the listener. Modify Listener.ora:

[Email protected] oracle]# su-oracle

[Email protected] ~]$ CD $ORACLE _base/product/10.2.0/db_1/network/admin

[Email protected] ~]$ VI Listener.ora

Add nodes:

(Sid_desc =
(Global_dbname = mydb)
(Oracle_home =/oracle/app/product/10.2.0/db_1)
(Sid_name = mydb)
)

Restart Oracle to connect ...

Existing instances Oracle under new instance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.