Table of Contents
步骤说明
1:创建文件夹
2:创建初始化参数文件
3:设置环境变量
4:创建实例
5:创建口令文件
6:启动数据库NOMOUNT状态
7:执行建库脚本
8:创建数据字典
9:创建package包
10:新建数据库后执行pupbld
11:创建SPFILE文件
12:执行Scott脚本
13:创建监听和TNSNAME
14 创建DBConcole
说明
广告博客
Home Database Mysql Tutorial Oracle手动创建数据库步骤说明

Oracle手动创建数据库步骤说明

Jun 07, 2016 pm 03:50 PM
oracle create database document step use illustrate

本文档主要使用分步骤的命令来创建Oracle数据库,而不是用Oracle的默认安装或者DBCA,意在详细了解Oracle数据库的文件体系(针对建库)以及相关的命令解释。 步骤说明 安装受到安装直接首先要明确一些信息: ORACLE_HOME:C:/oracle/product/10.2.0/db_1 DAT

本文档主要使用分步骤的命令来创建Oracle数据库,而不是用Oracle的默认安装或者DBCA,意在详细了解Oracle数据库的文件体系(针对建库)以及相关的命令解释。

步骤说明

安装受到安装直接首先要明确一些信息:

ORACLE_HOME:C:/oracle/product/10.2.0/db_1

DATABASE NAME、实例名以及ORACLE_SID:全部都是orcl

SYS和SYSTEM等用户的密码:oracle

1:创建文件夹

Oracle手动创建数据库步骤说明

2:创建初始化参数文件

数据库系统启动时须要用初始化参数文件的设置分配内存、启动必要的后台进程的。

该文件拷贝一个已有的文件稍加修改即可。

将该文件拷贝到C:/oracle/product/10.2.0/db_1/database里面取名initORCL.ora。

该文件路径也不一定非要放到这里,也可以是其他地方,默认是这个地方,不过如果放到其他地方在启动实例时需要添加相关的文件路径即可。

里面的相关的文件dest路径与前面的创建的文件夹路径应该保持一致。


3:设置环境变量

Oracle手动创建数据库步骤说明

使环境变量对应数据库的相关实例。

4:创建实例

Oracle手动创建数据库步骤说明

使用oradim创建新实例,实例名与数据库名一致,直接输入oradim回车有相关命令的帮助。

创建完实例之后我们就可以在服务列表中看到Oracle的服务了,但是如果使用sqlplus连接上去是连接的空闲实例。

5:创建口令文件

Oracle手动创建数据库步骤说明

orapwd是创建口令文件的工肯程序各称,file参数指定口令文件所在的目录和文件名称,password参数指定sys用户的口令,entries参数指定数据库拥用DBA权限的用户的个数。详细参考orapwd回车查看相关帮助。

该路径必须是在ORACLE_HOME/database/文件夹下。

6:启动数据库NOMOUNT状态

Oracle手动创建数据库步骤说明

大家都知道数据库启动有三个状态,Nomount状态(启动实例),mount状态(打开控制文件),Open状态(打开数据库),因为现在还没有创建控制文件和数据文件,现在进行启动实例阶段来创建相关的文件,看到在启动实例出现错误,那是一开始我创建文件时没有创建ORACLE_HOME/flash_recovery_area,因为在初始化参数时有一个

db_recovery_file_dest=C:/oracle/product/10.2.0/flash_recovery_area,所以没有找到报错,添加上即可。

如果前面第二步的路径变化了,在启动实例时需要添加startup nomount pfile=路径即可

7:执行建库脚本


Oracle手动创建数据库步骤说明

在执行该文件如果出现以上错误,修改session 的字符集。在执行该建库SQL的文件时,尽量检查好SQL文件。

Oracle手动创建数据库步骤说明

执行库SQL我们看到相关的数据文件、控制文件、重读日志文件都创建好了。

Oracle手动创建数据库步骤说明

8:创建数据字典

Oracle手动创建数据库步骤说明

该步执行时间比较长,主要是创建相关的字典表,比如我们经常遇到的dba_users、dba_tablespaces等表。

该脚本创建相对于系统基表的视图和系统动态性能视图以及他们的同义词。该脚本又同时运行创建其他对象的脚本,主要有:


9:创建package包

Oracle手动创建数据库步骤说明

该脚本主要用于建立PL/SQL功能的使用环境。此外,还创建几个PL/SQL包用于扩展RDBMS功能。该脚本同时还为下面的一些RDBMS功能创建另外的一些包和视图:


10:新建数据库后执行pupbld

Oracle手动创建数据库步骤说明

有时出于安全考虑需要禁止一些业务系统的数据库用户执行sqlplus命令,方法很简单:在运行命令之前,将这些命令限制到一个由 SQL*Plus 引用的“特殊位置”。 此特殊位置是SYSTEM 模式中一个名为PRODUCT_USER_PROFILE 的表。 如果该表不存在,则您在每次启动 SQL*Plus 时将获得一个类似“Product User Profile Not Loaded”这样的警告。

为了创建这个表,需要运行pupbld.sql脚本。通常,这个脚本在$ORACLE_HOME/sqlplus/admin 路径中运行,具体的位置由系统决定。记住用system用户执行:

11:创建SPFILE文件

spfile是存储初始参数的文件,oracle中有大约200多个初始参数,都存在这里,还有一种叫pfile的文件也是存储初始参数的文件,两者的区别是,spfile是server端维护的,pfile是客户端维护的,spfile只能通过系统更改,pfile 可以使用文本文件打开后手工修改。

Oracle手动创建数据库步骤说明

创建这一步需要使用sys用户,因为刚才连接的是system用户,需要连接到sys用户,然后在使用过程中如果出现上面的错误,需要先关闭一下数据库再重新启动即可。

为什么要创建spfile文件,因为原来在9i之前有pfile文件都在用户客户端,而且文本可以直接打开,每个客户端就可以修改,这样势必在启动时读取该配置文件带来了问题,所以Oracle引入了spfile放在服务器端,而且是二进制的文件,在启动实例时,先读取spfile文件,如果没有再读取initSID.ora,如果再没有读取pfile文件。

12:执行Scott脚本

Oracle手动创建数据库步骤说明

执行完毕之后我们就可以使用scott用户及其相关数据了。

关于Scott的由来可以参考:

http://blog.csdn.net/wh62592855/archive/2009/10/22/4712063.aspx

顺便了解一下Oracle的历史。

13:创建监听和TNSNAME

该步骤也是一样,用户可以使用netca创建,也可以将已有的配置文件修改后放到

C:/oracle/product/10.2.0/db_1/NETWORK/ADMIN下面即可。

配置完后就可以启动数据库了。

Oracle手动创建数据库步骤说明

14 创建DBConcole

Oracle手动创建数据库步骤说明

Oracle手动创建数据库步骤说明

在执行相关命令后,会提示你输入相关的信息比如SID,端口号等,而且该步骤等待时间比较长。

参考文档:http://hi.baidu.com/sammyhxm/blog/item/e27ec111695118cda6ef3f09.html

说明

该文档为作者在学习ArcGIS的一些笔记(自己学习、ArcGIS帮助、网络资源、高手请教相结合),难免有一些表达不全面或者理解有出入的,还请各位多多指教!

广告博客

http://www.gisall.com/index.php?uid-121719 :欢迎访问GIS博客

http://blog.csdn.net/linghe301:欢迎访问GIS博客

或者在百度文科上搜索:linghe301

By Lish

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 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)

MySQL: An Introduction to the World's Most Popular Database MySQL: An Introduction to the World's Most Popular Database Apr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

What to do if the oracle can't be opened What to do if the oracle can't be opened Apr 11, 2025 pm 10:06 PM

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

Why Use MySQL? Benefits and Advantages Why Use MySQL? Benefits and Advantages Apr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

How to solve the problem of closing oracle cursor How to solve the problem of closing oracle cursor Apr 11, 2025 pm 10:18 PM

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

How to create cursors in oracle loop How to create cursors in oracle loop Apr 12, 2025 am 06:18 AM

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

How to stop oracle database How to stop oracle database Apr 12, 2025 am 06:12 AM

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

How to create oracle dynamic sql How to create oracle dynamic sql Apr 12, 2025 am 06:06 AM

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values ​​to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.

What steps are required to configure CentOS in HDFS What steps are required to configure CentOS in HDFS Apr 14, 2025 pm 06:42 PM

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

See all articles