1. Create, configure, or delete databases by running Oracle database Configuration Assistant (You can also enter DBCA at the command line);
2. Building a database using a command-line approach
3. Create, configure, or delete a database by running a custom batch script (or Create_oracle_sid.bat (Create_oracle_sid.sql)).
Detailed:
1. Create, configure, or delete databases by running Oracle database Configuration Assistant;
DBAs who are not familiar with the creation process are advised to use this method by simply configuring the option "next" to generate a database creation script (recommended retention), or to create a database directly;
Advantages: Gui method is easy to use;
Disadvantages: But the creation process is somewhat slow;
2. Building a database using a command-line approach
Copy Code code as follows:
Connect/as SYSDBA
STARTUP pfile= ' C:oracleadmininit_testorcl.ora ' nomount;
CREATE DATABASE testorcl datafile '/u02/oracle/testorcl/system01.dbf ' SIZE 100M
LOGFILE GROUP1 ('/u01/oracle/testorcl/redo1a.log ',
'/u02/oracle/testorcl/redo1b.log ') SIZE 500K,
GROUP2 ('/u01/oracle/testorcl/redo1a.log ',
'/u02/oracle/testorcl/redo1b.log ') SIZE 500K
CHARACTER SET zhs16cgb231280;
--Convert the database directly from the build state to the open state
ALTER DATABASE OPEN;
--delete database (dropping a)
SPOOL C:drop_database. BAT
SELECT ' DEL ' | | NAME deletes database related data files from V$datafile;
SELECT ' DEL ' | | Member deletes the data refactoring log file from V$logfile;
SPOOL off;
Advantages: Can be familiar with the creation of instructions, creating principles;
Disadvantage: Simple configuration, requires memorizing command line instructions;
3. Create by running a custom batch or SQL script (Create_oracle_sid.bat or Create_oracle_sid.sql)
Copy Code code as follows:
--create_oracle_sid.bat
Set oracle_sid= Oracle_sid.
Del C:oracle8idatabasepwdoracle_sid.ora
C:oracle8ibinoradim-new-sid Oracle_sid. -intpwd Oracle-startmode Manual
-pfile C:oracle8iadminoracle_sidpfileinit.ora
C:ORACLE8IBINSVRMGRL @c:winntprofilesadministratorlboracle_sidrun.sql
C:ORACLE8IBINSVRMGRL @c:winntprofilesadministratorlboracle_sidrun1.sql
C:oracle8ibinoradim-edit-sid Oracle_sid-startmode Auto
--oracle_sidrun.sql
Spool C:oracle8iadminoracle_sidcreatecreatedb
Set echo on
Connect internal/oracle
Startup Nomount Pfile=c:oracle8iadminoracle_sidpfileinit.ora
CREATE DATABASE Oracle_sid
LOGFILE ' C:oracle8ioradataoracle_sidredo01.log ' SIZE 1024K,
' C:oracle8ioradataoracle_sidredo02.log ' SIZE 1024K
Maxlogfiles 32
Maxlogmembers 2
Maxloghistory 1
DataFile ' c:oracle8ioradataoracle_sidsystem01.dbf ' SIZE 50M reuse
Maxdatafiles 254
Maxinstances 1
CHARACTER SET Zht16big5
National CHARACTER SET Zht16big5;
Spool off
--oracle_sidrun1.sql
Spool C:ORACLE8IADMINORACLE_SIDCREATECREATEDB1
Set echo on
Connect internal/oracle
ALTER DATABASE datafile ' c:oracle8ioradataoracle_sidsystem01.dbf ' autoextend on;
CREATE ROLLBACK SEGMENT sysrol tablespace "SYSTEM" STORAGE (INITIAL 100K NEXT 100K);
ALTER ROLLBACK SEGMENT "Sysrol" ONLINE;
Oracle operations under Linux platform
The following Oracle operations are done under the Linux platform!
1.su Oracle
2.sqlplus/logon
3.connect test/test Assysdba (Test/test is an Oracle user and password)
4.startup
5.lsnrctl
Preferred Startup Database
Su-oracle
Sqlplus/nolog
Conn/as SYSDBA
Startup
And then start listening:
Enter/opt/oracle/product/9.2.0/bin/
Lsnrctl start
Run the Shudown command to close the database
[oracle@wing/oracle]$ sqlplus "/As SYSDBA"//For SYSDBA user login to Database
sql> shutdown
Launch Oracle 9i Database
[Oracle@wing bin]$ sqlplus "/as sysdba"
Sql> Startup
Start Oracle 9i Listener
Oracle's listener primarily provides interfaces for client connections
[Oracle@wing bin]$ Lsnrctl
Lsnrctl> start
Turn off Oracle 9i listeners
[Oracle@wing bin]$ Lsnrctl
Lsnrctl> stop
Let's see if the ORACLE_SID environment variable is set correctly.
9i:
$ sqlplus/nolog
Sql> Connect/as SYSDBA
Sql> Startup
$ lsnrctl Start
8i:
$ svrmgrl
Svrmgr> Connect Internal
Svrmgr> Startup
$ lsnrctl Start
Where is the error??
In general, just set these 2 places.
/etc/oratab
Ora2:/oracle/app/oracle/product/8.1.7:y
/etc/inittab
Oralce:2:wait:/bin/su-oracle-c '/oracle/app/oracle/product/8.1.7/bin/lsnrctl start '
Oracle:2:wait:/bin/su-oracle-c '/oracle/app/oracle/product/8.1.7/bin/dbstart '
Start Step:
Su-oracle
[Oracle@websvr1 oracle]$ Sqlplus/nolog
Sql> Connect/as SYSDBA
Sql> Startup
Sql> quit
[Oracle@websvr1 oracle]$ lsnrctl start
Available [oracle@websvr1 oracle]$ lsnrctl status to see if listening has started
Close step:
su-oracle
[oracle@websvr1 oracle]$ lsnrctl Stop
[oracle@websvr1 oracle]$ Sqlplus /nolog
sql> connect/as sysdba
sql> shutdown immediate
Sql> quit