Start and Stop Oracle databases and components

Source: Internet
Author: User

The management framework includes: database instance, listener, and Management Interface (database control, management proxy, which is used by Grid control)
Manage database control (Oracle provides a Database control console for databases that are not connected to crid control. One Database Control can only manage one Database, and EM is a web-based database control, you can use EM to view Alert Summary and performance mentoring, create and modify objects, and back up and restore the objects)
Start database control emctl start dbconsole
Stop database control emctl stop dbconsole
View database control status emctl status dbconsole
Access Method: http: // IP: port/em, where the port is viewed through $ ORACLE_HOME/install/portlist. ini. The default port is 1158,
If the port is correct and EM cannot be started, you can delete the previous EM configuration and reconfigure EM.
Delete EM: emca-deconfig dbcontrol db-repos drop
Re-build EM: emca-config dbcontrol db-repos create
Enable and stop a listener
Start lsnrctl start
Stop lsnrctl stop
View status lsnrctl status
SQL * plus (common command line tools)
1. sqlplus account name/password @ Instance name as role name
2. sqlplus sys/oracle as sysdba
3. show user;
4. exit
5. sqlplus/as sysdba
6. sqlplus hr/hr
7. Use in SQLplus; end (end of the statement)
8. view the current cache Value list abbreviated to l
9. Execute the SQL statement in the buffer/
10. save the saved path of the executed SQL statement. For example: save/u01/1. SQL
11. Switch to the operation :! ; Return to SQLPLUS: exit
12. How to execute the SQL Script: @ path/start path
13. You only want to view the script content. Do not run: get path.
14. Modify the statements in the buffer using the Editor (vi)
15. ed calls the editor to modify the data in the buffer.
16. Switch the user to use conn. For example, if you have logged on as a common user, switch to DBA conn/as sysdba.
17. Clear screen :! Clear
18. Run the host + operating system command in sqlplus, for example, host cp *
19. Disable database use: shutdown enable database use: startup
20. view the table structure description: desc table name, for example, desc temp
21. set environment variables: set linesize 100; set pagesize 100;
Isql * plus and SQL * plus (1. perform database management operations 2. query, insert, update, or delete data in the database by executing SQL commands)
Isql * plus (based on browsers, users with dba permissions cannot log on by default)
Start isqlplus Service isqlplusctl start
Enter URL http: // host name: port/isqlplus in the browser (default port: 5560)
Modify port $ ORACLE_HOME/install/portlist. ini file
Initialize the parameter file pfile & spfile (determines database startup)
(Pfile is often used before 9i; spfile is started when 9i appears (recommended ))
You can use vi to edit Pfile text files.
Name: init <sid>. ora
Path: $ ORACLE_HOME/dbs/
Source: 1 can be generated through create pfile from spfile
2. You can use books online
Books ---> Administrator's Guide --> 2 Creating an Oracle Database ---> Step 3: Create the Initialization Parameter File --> see "Understanding Initialization Parameters ". copy to your init <sid>. ora, and then modify the appropriate value to meet your needs.
3 Template cp $ ORACLE_HOME/dbs/init. ora initorcl. ora
4 if the database runs once, a pfile file is generated in/u01/app/oracle/admin/orcl/pfile.
The spfile binary file cannot be modified using the editor.
Use the alter commit me command to modify
Name: spfile <sid>. ora
Path: $ ORACLE_HOME/dbs, which can be viewed through strings spfileorcl. ora.
Source: 1. DBCA created and automatically generated
2. Use pfile to generate spfile: create spfile from pfile;
Example: create spfile = '/u01/sporcl. ora' from pfile = '$ ORACLE_HOME/dbs/initorcl. ora ';
View the content of the parameter file
V $ parameter:
Alter session set parameter = value. The modified session-level parameter is valid for the current session and is not saved.
V $ system_parameter displays system-level parameters;
Use alter system to modify parameters (scope = spfile, momoery, both if scope is omitted, it indicates modifying the parameters in spfile and current Memory)
Scope = memory: only the memory value is repaired and not saved to the parameter file.
= The spfile does not take effect currently. It only modifies the parameter file and takes effect at the next startup.
= The both table takes effect immediately and will take effect the next time it is started
V $ spparameter displays the parameter values saved in spfile (scope = spfile)
Show parameter spfile; check whether spfile or pfile is currently used.
Value: Start With spfile
No value: Start With pfile
Parameter category:
Static Parameters: Only parameter files can be modified and will take effect at next startup.
Dynamic parameters: parameters that can take effect immediately
(The field name in v $ PARAMETER is ISSYS_MODIFIABLE to determine the PARAMETER type. FALSE: the static PARAMETER indicates that the instance must be restarted and takes effect)
IMMEDATE: a dynamic parameter that takes effect immediately and will take effect the next time the instance is restarted.
DEFERRED: dynamic parameter. The current session takes effect. The value is restored after the instance is restarted.
Select distinct issys_modifiable from v $ parameter;
Database startup and Shutdown
Start SQL> startup [option]
Nomount
Process
Search for files with specific names in <oracle_home>/dbs in the following order:
Spfile <SID>. ora
If not found, search for spfile. ora
If not found, search for init <SID>. ora
Allocate SGA
Start background processes
Open the alert <SID>. log File and tracking File
Purpose: During database creation, re-creation of control files, and execution of some backup and recovery plans
Mount
Process
Associate a database with a previously started instance
Locate and open the specified control file in the parameter file
Read the control file to obtain the name and status of the data file and the online redo log file. However, you do not have to perform any check to verify the number
Whether the log files of data files and online redo logs exist
Role: Rename data files, enable and disable online redo log file archiving options, and perform complete database recovery
Open (all data files can be opened and online redo files can be verified) (default)
Process
Open Online Data Files
Open Online redo log file
Disable SQL> shutdown [option]
Normal (default)
You cannot create a new connection.
The Oracle server is closed only when all users are disconnected.
The database and redo buffer will be written to the disk.
Background process terminated, deleting SGA from memory
The Oracle server closes and disconnects the database before closing the instance.
Instance recovery is not required for the next start.
TRANSACTIONAL
No client can use this particular instance to start new transaction processing.
The client disconnects after the ongoing transaction processing.
Close immediately after all transactions are processed.
Instance recovery is not required for the next start.
IMMEDIATE
The current SQL statement being processed by the Oracle database has not been completed yet.
The Oracle server does not wait for the user currently connected to the database to disconnect.
The Oracle Server rolls back the active transaction processing and disconnects all connected users.
The Oracle server closes and disconnects the database before closing the instance.
Instance recovery is not required for the next start.
ABORT
Terminate the SQL statement being processed by the Oracle database immediately.
The Oracle server does not wait for the user currently connected to the database to disconnect.
The database and redo buffer are not written to the disk.
Do not roll back uncommitted transactions.
The instance has been terminated, but the file is not closed.
The database is not closed or uninstalled.
The instance must be restored at the next startup, and the instance is automatically restored.
Warning log
Content: related link --> warning log Content alert _ <SID>. log is located on the database server and stored in the directory specified by the background_dump_dest initialization parameter.
History: related link --> alert history
Dynamic Performance view (through the dynamic performance view, you can access information about changing statuses and conditions in the database .) (Read may be inconsistent)
Content, session, File status, job and task progress, lock, backup status, memory usage and allocation, system and session parameters, SQL Execution, statistics, and measurement
Example: SQL> SELECT SQL _text, executions FROM v $ sqlWHERE cpu_time> 200000;
SQL> SELECT * FROM v $ session WHERE machine = 'edrsr9p1' and logon_time> SYSDATE-1;
SQL> SELECT sid, ctime FROM v $ lock WHERE
Block> 0;

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.