Oracle learning notes

zhaozj2021-02-16  50

Chapter II

1. Launch Oracle Server.

Startup [Nomount | Mount | Open] [Force] [Pfile = filename]

Parameter Description:

Nomount: Start instance

Mount: Start the instance and load the database

Open: Start instance, load and open the database.

FORCE: Terminate the instance and restart the database. (Default option)

Pfile: Specifies non-default parameter file name.

2. Stop Oracle Server

Shutdown [Normal | Transactional | Immediate | Abort]

Parameter Description:

Normal: Waiting for the user to disconnect an existing connection, the system issues a checkpoint, then in the synchronization data file, control text

Close after the log file (default option)

TRANSACTIONAL: After waiting for the client to end the transaction, automatically disconnect the user connection, then execute Normal.

Immediate: Cancel all current SQL statements, roll back all unfinished transactions, then automatically disconnect, and then execute Normal.

Abort: Terminate all SQL statements to terminate instances immediately. Will not issue a checkpoint, so you will not go to sync data files, control files, and redo log files.

3. Summary and related scripts

A. Modify the data file name, perform full recovery, perform incomplete recovery, change the log operation mode when the log operation mode must start the instance and install the database, Startup Mount;)

B. When you create a database or create a control file, the system is only started instance status (startup nomount;)

C. Display SGA size (SHOW SGA or SELECT * FROM V $ SGA)

D. Show the background process currently running (SELECT NAME FROM V $ BGPROCESS WHERE PADDR! = '00')

E. Show Oracle Server status (Select Status from V $ Instance)

F. Display initialization parameter information (SELECT * from V $ parameter);

G. Show physical files (SELECT * from V $ Controfile; SELECT * from V $ datafile; select * from v $ logfile;

H. Some data dictionary attempt:

All_Objects, User_Objects, DBA_Objects, User_Source, User_SEGMENTS,

User_tab_columns, user_constraints, all_users

I. For the customer application, you can access Oracle Server, you need to configure the listener.ora file on the server side, you need to configure the tnsnames.ora file on the client.

Chapter III Control File

1. Control file main information:

Database name; database file name and location; redo log file name and location; table space name;

Current log serial number; checkpoint information; log history information.

2. Diversified control file

1. Close the database

SQLPlus / Nolog;

Connect system / admin @ lgtest as sysdba;

Shutdown immediate;

2. Copy control file

Copy Source ControlFile to Dest ControlFile

For example: COPY E: /Oracle/roadata/lgtest/control01.ctl f: /controltest.ctl3. Modify initialization parameter control_files

Control_files = E: /oracle/oradata/lgtest/control01.ctl, f: /controltest.ctl

4. Start database

Startup Pfile = E: / Oracle / Admin / LGTEST / PFILE / INIT.ORA.108200317263

Its role: After a diversified control file, as long as one control file is not damaged, the system can continue to operate after removing other corrupted control files from the initialization parameter file.

3. Reconstruction of control files

1. Start instances in Nomount

SQLPlus / Nolog;

Connect system / admin @ lgtest as sysdba;

Shutdown normal;

Startup Nomount Pfile =% racle_home% / Database / Init.ora;

2. Establish a control file

Create ControlFile Reuse Database LGTest Resetlogs

Logfile

Group 1 'E: / Oracle / ORADATA / LGTEST / Redo01.log' Size 20M,

Group 2 'E: / Oracle / ORADATA / LGTEST / Redo02.log' Size 20M

DataFile

'E: / Oracle / ORADATA / LGTEST / SYSTEM01.DBF',

'E: / Oracle / ORADATA / LGTEST / UNDOTBS01.DBF'

Character set zhs16gbk;

3. Open the database

Alter Database Open Resetlogs;

4. Increase temporary files

ALTER TABLESPACE TEMP ADD TEMPFILE 'E: /Oracle/oradata/lgtest/temp01.dbf' Reuse;

A role: When the control file is damaged, as long as there is all of the data files and redo log files, the system can continue to run by rebuilding the control file.

转载请注明原文地址:https://www.9cbs.com/read-27358.html

New Post(0)