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:
- 2010-01-24 20:47 1,783 cloneDBCreation.sql
- 2010-01-24 20:47 321 CloneRmanRestore.sql
- 2010-01-24 20:48 2,410 init.ora
- 2010-01-24 20:48 2,177 initXETemp.ora
- 2010-01-24 20:47 929 postDBCreation.sql
- 2010-01-24 20:47 780 postScripts.sql
- 2010-01-24 20:47 1,334 rmanRestoreDatafiles.sql
- 2010-01-24 20:47 1,424 XE.bat
- 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.
- variable devicename varchar2(255);
- declare
- omfname varchar2(512) := NULL;
- done boolean;
- begin
- dbms_output.put_line(' ');
- dbms_output.put_line(' Allocating device.... ');
- dbms_output.put_line(' Specifying datafiles... ');
- :devicename := dbms_backup_restore.deviceAllocate;
- dbms_output.put_line(' Specifing datafiles... ');
- dbms_backup_restore.restoreSetDataFile;
- dbms_backup_restore.restoreDataFileTo(1, 'D:\oraclexe\oradata\XE\system.dbf', 0, 'SYSTEM');
- dbms_backup_restore.restoreDataFileTo(2, 'D:\oraclexe\oradata\XE\undo.dbf', 0, 'UNDOTBS1');
- dbms_backup_restore.restoreDataFileTo(3, 'D:\oraclexe\\oradata\XE\sysaux.dbf', 0, 'SYSAUX');
- dbms_backup_restore.restoreDataFileTo(4, 'D:\oraclexe\oradata\XE\users.dbf', 0, 'USERS');
- dbms_output.put_line(' Restoring ... ');
- dbms_backup_restore.restoreBackupPiece
- ('D:\oraclexe\app\oracle\product\10.2.0\server\config\seeddb\EXPRESS.dfb', done);
- if done then
- dbms_output.put_line(' Restore done.');
- else
- dbms_output.put_line(' ORA-XXXX: Restore failed ');
- end if;
- dbms_backup_restore.deviceDeallocate;
- end;
- /
-
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:
- begin
- dbms_xdb.sethttpport('8080');
- dbms_xdb.setftpport('0');
- 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