Oracle XE built-in database creation process

Source: Internet
Author: User
Tags oracle materialized view

How is the built-in Oracle XE database created? This is a problem that many people have mentioned. The following describes how to create an Oracle XE database for your reference.

Let's briefly talk about the character set of Oracle 10g XE. Let's take a look at how Oracle XE's built-in database is created.

To be honest, when we first installed XE on Windows, the steps were very simple. We thought that Oracle had covered up all the details. After installing XE, we checked the related directories to make them much clearer. install xe on d: disk. the following files are available in the Directory D: \ oraclexe \ app \ oracle \ product \ 10.2.0 \ server \ config \ scripts:

 
 
  1. 2010-01-24  20:47             1,783 cloneDBCreation.sql  
  2. 2010-01-24  20:47               321 CloneRmanRestore.sql  
  3. 2010-01-24  20:48             2,410 init.ora  
  4. 2010-01-24  20:48             2,177 initXETemp.ora  
  5. 2010-01-24  20:47               929 postDBCreation.sql  
  6. 2010-01-24  20:47               780 postScripts.sql  
  7. 2010-01-24  20:47             1,334 rmanRestoreDatafiles.sql  
  8. 2010-01-24  20:47             1,424 XE.bat  
  9. 2010-01-24  20:47               716 XE.sql 

XE. the bat batch file completes the following tasks: add the required operating system user, create a directory to store Oracle data files, set the Oracle environment variable to the SID Name, and call the Oradim command to create the XE instance; then call XE. SQL script.

XE. the SQL script first defines the password required by the XE instance user, and then uses orapwd.exe to create the password file. These steps are very similar to the script used to create an Oracle instance. next, it's interesting: XE. SQL calls CloneRmanRestore. SQL, CloneRmanRestore. SQL calls rmanRestoreDatafiles. SQL.

 
 
  1. variable devicename varchar2(255);  
  2. declare  
  3. omfname varchar2(512) := NULL;  
  4.   done boolean;  
  5.   begin  
  6.     dbms_output.put_line(' ');  
  7.     dbms_output.put_line(' Allocating device.... ');  
  8.     dbms_output.put_line(' Specifying datafiles... ');  
  9.        :devicename := dbms_backup_restore.deviceAllocate;  
  10.     dbms_output.put_line(' Specifing datafiles... ');  
  11.     dbms_backup_restore.restoreSetDataFile;  
  12.       dbms_backup_restore.restoreDataFileTo(1, 'D:\oraclexe\oradata\XE\system.dbf', 0, 'SYSTEM');  
  13.       dbms_backup_restore.restoreDataFileTo(2, 'D:\oraclexe\oradata\XE\undo.dbf', 0, 'UNDOTBS1');  
  14.       dbms_backup_restore.restoreDataFileTo(3, 'D:\oraclexe\\oradata\XE\sysaux.dbf', 0, 'SYSAUX');  
  15.       dbms_backup_restore.restoreDataFileTo(4, 'D:\oraclexe\oradata\XE\users.dbf', 0, 'USERS');  
  16.     dbms_output.put_line(' Restoring ... ');  
  17.     dbms_backup_restore.restoreBackupPiece  
  18. ('D:\oraclexe\app\oracle\product\10.2.0\server\config\seeddb\EXPRESS.dfb', done);  
  19.     if done then  
  20.         dbms_output.put_line(' Restore done.');  
  21.     else  
  22.         dbms_output.put_line(' ORA-XXXX: Restore failed ');  
  23.     end if;  
  24.     dbms_backup_restore.deviceDeallocate;  
  25.   end;  
  26. /  
  27.  

It is very interesting. XE uses a non-conventional method: dbms_backup_restore process. I used to back up RMAN without using catalog and introduced the solution to control file loss:

In Versions later than Oracle 816, Oracle provides a package: DBMS_BACKUP_RESTORE.DBMS_BACKUP_RESTORE is composed of dbmsbkrs. SQL and prvtbkrs. the two plb scripts are created. catproc. these two packages are called after the SQL script is run. therefore, this package is available for every database. is the IO operation interface between the Oracle server and the operating system. directly called by the recovery manager.
OracleXE uses this package to back up 'd: \ oraclexe \ app \ oracle \ product \ 10.2.0 \ server \ config \ seeddb \ EXPRESS from a seed. dfb' restore the required file. note that there are only four necessary tablespaces above. The space restrictions mentioned in Oracle's release notes come from this place. as to whether the limit can exceed 4 GB, I will analyze it later.

Next, XE. SQL calls cloneDBCreation. SQL to create an available control file.
Dbms_backup_restore's zerodbid (0) function is used to create a new DBID.

Then

Alter database "XE" open resetlogs; alter database rename global_name to "XE"; a temporary tablespace Temp is added.

After the script is executed, XE. SQL calls postDBCreation. SQL and defines the port through the following process:

 
 
  1. begin  
  2.    dbms_xdb.sethttpport('8080');  
  3.    dbms_xdb.setftpport('0');  
  4. end; 

/Finally, XE. SQL calls postScripts. SQL, mainly for some subsequent operations, Patch scripts or something.

At this point, the database has been created. That is, during graphical installation, 1 ~ The process of omitting steps 5 is actually not that complicated.

For the Linux version, the scripts are stored in the directory/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts. except for calling the oradim.exe command, there is little difference.
 

Entire Process of creating Oracle Materialized View

ORACLE instance creation process

Statement syntax for oracle time addition and subtraction

Oracle deadlock handling

How to Implement Oracle fuzzy search

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.