Home Database Mysql Tutorial linux下手动创建Oracle数据库

linux下手动创建Oracle数据库

Jun 07, 2016 pm 03:01 PM
linux oracle create database

在linux平台上手动创建数据库(Oracle 10g),安装Oracle软件后,用手动创建数据库可以锻炼自己能力并能够了解数据库创建的全过程,步骤如下: 1、创建Oracle的SID,如果在linux上以dba组中的用户登陆查看主目录中的.bash_profile文件已经设置了此变量就可以

在linux平台上手动创建数据库(Oracle 10g),安装Oracle软件后,用手动创建数据库可以锻炼自己能力并能够了解数据库创建的全过程,步骤如下:

1、创建Oracle的SID,如果在linux上以dba组中的用户登陆查看主目录中的.bash_profile文件已经设置了此变量就可以不用设置了,如果一个服务器上运行了多个Oracle实例,则还需要设置export ORACLE_SID=myoral

也可以统一在一个文件中设置,然后执行这个文件,让所有关于Oracle的环境变量生效

 

创建一个目录param_myorcl.env

ORACLE_HOME=$ORACLE_HOME   (如果以前创建过Oracle数据库就可以直接利用以前设置的,否则要设置到Oracle安装的目录,可以设置到bin的上层目录)

OACLE_SID=myorcl

PATH=$ORACLE_HOME/bin:$PATH

LD_LIBRARY_PATH=$ORACLE_HOME/bin:$LD_LIBRARY_PATH

TNS_ADMIN=$ORACLE_HOME/network/admin

 

export ORACLE_HOME   ORACLE_SID  PATH LD_LIBRARY_PATH TNS_ADMIN

 

通过执行“ .   ./param_myorcl.env”可以使设置生效,但是这种方式是暂时的,否则可以直接更改.bash_profile使之永久生效

 

2、创建pfile,然后根据pfile创建spfile,利用spfile生成数据库实例(这是Oracle推荐的,虽然也可以利用pfile创建数据库实例)

方法一:如果服务器中已经存在一个数据库,可以通过create pfile from spfile创建pfile文件,再到$ORACLE_HOME/dbs/目录中cp initorcl.ora initmyorcl.ora,这样复制一份后再修改initmyorcl

方法二:strings spfileorcl.ora >initmyorcl.ora(注意要修改,linux上替换命令 : %s/orcl/myorcl/g)

方法三:网上找一份修改,呵呵呵

创建pfile后,检查环境变量是否生效 “env | grep ORA”

如果生效就可以启动Oracle实例了,启动后可以根据pfile创建spfile

         create spfile from pfile;

3、写创建数据库脚本myorcl.sql

spool  on
create database myorcl  
MAXINSTANCES 1 
MAXLOGHISTORY 1 
MAXLOGFILES 5 
MAXLOGMEMBERS 5 
MAXDATAFILES 100 
NATIONAL CHARACTER SET AL16UTF16  
DATAFILE  
'/u01/oracle/oradata/myorcl/system01.dbf' size 100m reuse autoextend on next 1m maxsize unlimited extent management

local  
sysaux datafile  
'/u01/oracle/oradata/myorcl/sysaux01.dbf' size 100m reuse autoextend on next 1m maxsize unlimited  
default temporary tablespace TEMP tempfile  
'/u01/oracle/oradata/myorcl/temp01.dbf' size 20m reuse autoextend on next 640k maxsize unlimited  
undo tablespace UNDOTBS1 datafile  
'/u01/oracle/oradata/myorcl/undo01.dbf' size 20m reuse autoextend on next 5M maxsize unlimited  
logfile  
GROUP 1 ('/u01/oracle/oradata/myorcl/redo1.dbf') size 10m,  
GROUP 2 ('/u01/oracle/oradata/myorcl/redo2.dbf') size 10m,  
GROUP 3 ('/u01/oracle/oradata/myorcl/redo3.d

;

spool off

4、创建数据库

   @$ORACLE_HOME/dbs/myorcl.sql   

 

5、创建数据库数据字典

    spool log1.log

    @?/rdbms/admin/catalog.sql

    @?/rdbms/admin/catproc.sql

    @?/sqlplus/admin/pupbld.sql  
 

 

 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

MySQL: Structured Data and Relational Databases MySQL: Structured Data and Relational Databases Apr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

How to set important Git configuration global properties How to set important Git configuration global properties Apr 17, 2025 pm 12:21 PM

There are many ways to customize a development environment, but the global Git configuration file is one that is most likely to be used for custom settings such as usernames, emails, preferred text editors, and remote branches. Here are the key things you need to know about global Git configuration files.

MySQL: Key Features and Capabilities Explained MySQL: Key Features and Capabilities Explained Apr 18, 2025 am 12:17 AM

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

MongoDB vs. Oracle: Choosing the Right Database for Your Needs MongoDB vs. Oracle: Choosing the Right Database for Your Needs Apr 22, 2025 am 12:10 AM

MongoDB is suitable for unstructured data and high scalability requirements, while Oracle is suitable for scenarios that require strict data consistency. 1.MongoDB flexibly stores data in different structures, suitable for social media and the Internet of Things. 2. Oracle structured data model ensures data integrity and is suitable for financial transactions. 3.MongoDB scales horizontally through shards, and Oracle scales vertically through RAC. 4.MongoDB has low maintenance costs, while Oracle has high maintenance costs but is fully supported.

See all articles