Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to manually create a database by Oracle

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how Oracle creates databases by hand. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Steps for manually creating a database

1. Create instance steps

① prepares parameter file pfile/spfile (refer to database software installation init file)

② starts the instance instance

two。 Create a database database

① prepares create database statements

② executes create database statement

③ executes post script

④ validates the database creation result

Steps to begin: first, create an instance instance

-- adjust to pfile parameter file according to init.ora file in $ORACLE_HOME/dbs directory

$cd $ORACLE_HOME/dbs

$cat init.ora | grep-v ^ # | grep-v ^ $> initORCL.ora

Where-v ^ # removes all comments

-v ^ $is to remove all blank lines

-- adjust the contents of the pfile parameter file

$vi initORCL.ora

Db_name='ORCL'

Memory_target=1G

Processes = 150

Audit_file_dest='/admin/orcl/adump'

Audit_trail = 'db'

Db_block_size=8192

Db_domain=''

Db_recovery_file_dest='/flash_recovery_area'

Db_recovery_file_dest_size=2G

Diagnostic_dest=''

Dispatchers=' (PROTOCOL=TCP) (SERVICE=ORCLXDB)'

Open_cursors=300

Remote_login_passwordfile='EXCLUSIVE'

Undo_tablespace='UNDOTBS1'

Control_files = (ora_control1, ora_control2)

Compatible = '11.2.0'

-- the final results are as follows:

Db_name='ORCL'

Memory_target=1G

Processes = 150

Audit_file_dest='/u01/app/oracle/admin/ORCL/adump'

Audit_trail = 'db'

Db_block_size=8192

Db_domain=''

Db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

Db_recovery_file_dest_size=2G

Diagnostic_dest='/u01/app/oracle'

Dispatchers=' (PROTOCOL=TCP) (SERVICE=ORCLXDB)'

Open_cursors=300

Remote_login_passwordfile='EXCLUSIVE'

Undo_tablespace='UNDOTBS1'

Control_files = (/ u01qapax oraclecontrol oradata / u01Accord oradata control 01.ctljigmage u01apapplicoraclecontrol oradata / orcl control 02.ctl)

Compatible = '11.2.0'

-- .bash _ profile file adds the following

$vi .bash _ profile

Export ORACLE_BASE=/u01/app/oracle

Export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

Export ORACLE_SID=ORCL

Export PATH=$ORACLE_HOME/bin:$PATH

-- change the variable to take effect

$. . / .bash _ profile

Or

$source .bash _ profile

-- validate environment variables

$echo $ORACLE_HOME

$echo $ORACLE_SID

-enter the ORACLE_BASE directory

$cd $ORACLE_BASE

-create directories (create all directories in pfile)

$mkdir-p admin/ORCL/adump

$mkdir-p flash_recovery_area

$mkdir-p oradata/ORCL

-- generate spfile based on pfile parameter file

$sqlplus / as sysdba

SQL > create spfile from pfile

-- Boot to nomount state

SQL > startup nomount

2. Prepare database database

-- write the following

$vi create_db.sql

CREATE DATABASE ORCL

USER SYS IDENTIFIED BY oracle

USER SYSTEM IDENTIFIED BY oracle

LOGFILE GROUP 1 ('/ u01 BLOCKSIZE SIZE) SIZE 100m oradata

GROUP 2 ('/ u01 BLOCKSIZE) SIZE SIZE BLOCKSIZE 512

GROUP 3 ('/ u01 BLOCKSIZE SIZE) SIZE 100m oradata

MAXLOGFILES 5

MAXLOGMEMBERS 5

MAXLOGHISTORY 1

MAXDATAFILES 100

CHARACTER SET AL32UTF8

NATIONAL CHARACTER SET AL16UTF16

EXTENT MANAGEMENT LOCAL

DATAFILE'/ u01 SIZE DATAFILE'/ u01 REUSE

SYSAUX DATAFILE'/ u01 SIZE SYSAUX DATAFILE'/ u01 SYSAUX DATAFILE'/ u01 SIZE

DEFAULT TABLESPACE users

DATAFILE'/ u01qqappActionoradataUS01.dbf'

SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

DEFAULT TEMPORARY TABLESPACE tempts1

TEMPFILE'/ u01qqapp.oracle.oradata.orCLUniver temp01.dbf'.

SIZE 20M REUSE

UNDO TABLESPACE undotbs1

DATAFILE'/ u01qqappActionoradataUndotbs01.dbf'

SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

Note that the name of the undo tablespace should be the same as the file name in spfile.

-list of content to be adjusted

1) change the database name to ORCL

2) change the password of SYS and SYSTEM users to oracle

3) modify the path of data file and log file

-- execute the above script

SQL > @ / home/oracle/create_db.sql

-- execute post script file (SYS user)

SQL > @? / rdbms/admin/catalog.sql-data dictionary, dynamic view

SQL > @? / rdbms/admin/catproc.sql-- PL/SQL stored procedure related code

SQL > @? / rdbms/admin/utlrp.sql-- compile the object

-- execute the following script (system user)

SQL > @? / sqlplus/admin/pupbld.sql-- SQL*Plus related scripts

Verify database availability

SQL > select status from v$instance

SQL > select * from v$version

Thank you for reading! This is the end of this article on "how to create a database by Oracle by hand". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report