Create a database instance in Oracle 11gR2

Source: Internet
Author: User

Because the work requires a new database instance in the Oracle 11gR2 database. We recommend that you use oracle to perform the following operations. The order is as follows:

1. Create a parameter file for instance startup. Modify the default parameter file of the program: Rename the rule initSID. ora.

In the/u01/oracle/product/11.2.0/db_1/dbs/directory, use absolute paths as much as possible, and use environment variables such as ORACLE_BASE to report errors.

Example: initcrm. ora

Db_name = 'crm '-- modify
# Memory_target = 500 m -- Comment out
Sga_target = 200 m -- add
Pga_aggregate_target = 60 m -- add
Processes = 150
Audit_file_dest = '/u01/oracle/admin/crm/adump' -- create a directory
Audit_trail = 'db'
DB _ block_size = 8192
Db_domain =''
Db_recovery_file_dest = '/u01/oracle/flash_recovery_area' -- create a directory
Db_recovery_file_dest_size = 2G
Diagnostic_dest = '/u01/oracle' --- modify
Dispatchers = '(PROTOCOL = TCP) (SERVICE = ORCLXDB )'
Open_cursors = 300
Remote_login_passwordfile = 'clusive'
Undo_tablespace = 'undotbs1'

 

2. Create a directory:

Mkdir-p/u01/oracle/admin/ora11g/adump
Mkdir-p/u01/oracle/admin/ora11g/dpdump
Mkdir-p/u01/oracle/flash_recovery_area

3. Create a password file: The naming rule orapwSID. The directory is still/U01/oracle/product/11.2.0/db_1/dbs/
LinuxLower orapw + Instance name
WindowsUnder pwd + Instance name

$ Orapwd file = orapwora11g password = oracle 4. Create a database instanceSet the environment variable export ORACLE_SID = crm and execute the following command sqlplus/nolog
Conn/as sysdba Note: possible causes of this error may be reported: a) whether the glibc-devel-2.5-58.el5_6.4, libaio-0.3.106-5 package is installed, commands are rpm-q glibc-devel, rpm-q libaio B) oracle directory permissions are insufficient or the group is incorrect. chmod 6751 oracle authorization, chown-R oracle. oinstall/u01/oracle modify Group
Run the database creation script: Startup nomount pfile = "/u01/oracle/product/11.2.0.1/db1/dbs/initcrm. ora ";
Create database "crm"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/u01/oracle/oradata/system01.dbf' SIZE 1024 M REUSE
EXTENT MANAGEMENT LOCAL
Sysaux datafile '/u01/oracle/oradata/sysaux01.dbf' SIZE 500 M REUSE
Smallfile default temporary tablespace temp tempfile '/u01/oracle/oradata/temp01.dbf' SIZE 20 M REUSE
Smallfile undo tablespace "UNDOTBS1" DATAFILE '/u01/oracle/oradata/undo01.dbf' SIZE 300 M REUSE
Character set ZHS16GBK
National character set AL16UTF16
Logfile group 1 ('/u01/oracle/oradata/log01.dbf') SIZE 50 M,
GROUP 2 ('/u01/oracle/oradata/log02.dbf') SIZE 50 M,
GROUP 3 ('/u01/oracle/oradata/log03.dbf') SIZE 50 M;   Create USERS tablespace
Create smallfile tablespace "USERS" logging datafile '/u01/app/oradata/user01.dbf' SIZE 1000 M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE Management auto;
Alter database default tablespace "USERS "; ------------------------------------------ SQL> create spfile from pfile; File created. -----------------------------------------

Sqlplus/as sysdba
SQL> show user;
@/U01/oracle/product/11.2.0.1/db1/rdbms/admin/catalog. SQL;
@/U01/oracle/product/11.2.0.1/db1/rdbms/admin/catblock. SQL;
@/U01/oracle/product/11.2.0.1/db1/rdbms/admin/catproc. SQL;
@/U01/oracle/product/11.2.0.1/db1/rdbms/admin/catoctk. SQL;
@/U01/oracle/product/11.2.0.1/db1/rdbms/admin/owminst. plb;


Compile with the system user
@/U01/oracle/product/11.2.0.1/db1/sqlplus/admin/pupbld. SQL;
@/U01/oracle/product/11.2.0.1/db1/sqlplus/admin/help/hlpbld. SQL helpus. SQL;

Compile with sys user
@/U01/oracle/product/11.2.0.1/db1/javavm/install/initjvm. SQL;
@/U01/oracle/product/11.2.0.1/db1/xdk/admin/initxml. SQL;
@/U01/oracle/product/11.2.0.1/db1/xdk/admin/xmlja. SQL;
@/U01/oracle/product/11.2.0.1/db1/rdbms/admin/catjava. SQL;
@/U01/oracle/product/11.2.0.1/db1/rdbms/admin/catexf. SQL;
@/U01/oracle/product/11.2.0.1/db1/rdbms/admin/catqm. SQL change_on_install SYSAUX TEMP YES;
@/U01/oracle/product/11.2.0.1/db1/rdbms/admin/catxdbj. SQL;
@/U01/oracle/product/11.2.0.1/db1/rdbms/admin/catrul. SQL;

 

Spool/oracle/admin/edidb/scripts/ordinst. log append
@/U01/oracle/product/11.2.0.1/db1/ord/admin/ordinst. SQL SYSAUX;
Spool off

Spool/u01/oracle/admin/ora11g/scripts/interMedia. log append
@/U01/oracle/product/11.2.0.1/db1/ord/im/admin/iminst. SQL;
Spool off

Set echo on
Spool/oracle/admin/edidb/scripts/lockAccount. log append
BEGIN
FOR item IN (select username from DBA_USERS WHERE ACCOUNT_STATUS IN ('open', 'locked', 'expired') and username not in (
'Sys ', 'system '))
LOOP
Dbms_output.put_line ('locking and Expiring: '| item. USERNAME );
Execute immediate 'alter user' |
Sys. dbms_assert.enquote_name (
Sys. dbms_assert.schema_name (
Item. USERNAME), false) | 'password expire account lock ';
End loop;
END;
/
Spool off

At this point, the database instance has been created.   6. Configure tns and listenser /U01/oracle/product/11.2.0.1/db1/network/admin/ Tnsnames. ora CRM = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521) ) ) (CONNECT_DATA = (SERVICE_NAME = crm) ) )  Listener. oraThere are many listener methods. If the requirement is not high, we recommend that you use the original listener. The advantage is that the listener changes slightly. The disadvantage is that the public listener of different instances may be inconvenient. Listener. ora SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME =/u01/oracle/product/11.2.0.1/db1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = crm)
(ORACLE_HOME =/u01/oracle/product/11.2.0.1/db1)
(SID_NAME = crm)
)
)Single configuration listening:

SID_LIST _LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = crm)
(ORACLE_HOME =/u01/oracle/product/11.2.0.1/db1)
(PROGRAM = extproc)
)
)

LISTENER=
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.100) (PORT = 1521 ))
)
)

Note: The Yellow background must be corresponding and cannot be the database instance name. Note that the listener port corresponds to the tns port. When the listener mode is used, @ crm or toad login appears ORA-12537 connection close error, but tnsping crm is normal, set sqlnet. ora parameter TCP. VALIDNODE _CHECKING = no: the problem persists. It should be determined that the listener Configuration problem should be solved in the first way.   7. Stop the instance, start the instance, stop the listener, and start the instance. Complete database instanceAnd listenersLoad Sqlplus/as sysdbaSQL> shutdown immediate -- "close database instance" SQL> startup -- "Start database instance"
SQL> exit $ lsnrctl stop listener-stop listening service named listener $ Lsnrctl start listener-start the listener service named listener $ Lsnrctl reload listener-reload the listener service named listener

Related Article

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.