Command
Description
Crsctl start has
Start the database has service.
CRSCTL Stat res-t
Check the status of each service (DG, monitor, asm instance, etc.) in ASM.
SRVCTL Status ASM
View the ASM instance state, normally the ASM instance of the master standby should be in the boot state.
Srvctl start ASM
Launches an ASM instance.
Srvctl Stop ASM
Stop the ASM instance.
Srvctl Status Diskgroup-g dgname
View the Database DG status.
Example: Srvctl status Diskgroup-g Dg_ora
Srvctl Stop Diskgroup-g Dgname
Stop the Database DG.
Srvctl Start Diskgroup-g Dgname
Start the Database DG.
Srvctl Enable Diskgroup-g Dgname
Activates the database.
Srvctl Disable Diskgroup-g Dgname
To activate the database.
Sql> alter DiskGroup Dgname Mount;
Mount the Database DG.
sql> alter DiskGroup Dgname Unmount;
Unload the Database DG.
Sql> select Name,state,type,total_mb,free_mb from V$asm_diskgroup;
Query the Database DG name, type, state, total space, and remaining space.
Sql> select Name,group_number,path,mode_status,state from V$asm_disk;
Query the name, path, and state of the Database DG.
Asmcmd Tools
The Asmcmd Access tool interface is executed under the grid user, and the Asmcmd tool provides common commands such as CD, CP, Du, find, ls, pwd, RM, mkdir, and can be used to view a detailed explanation of the command in the form of a help+ command.
Sql> select instance_name from V$instance;
Query the ASM instance name.
Query instance and database state.
Sql> select status from V$instance;
The value of "STATUS" should be "OPEN".
Sql> select Open_mode from V$database;
The value for "Open_mode" should be "READ WRITE". Queries the DB instance.
Sql> select instance_name from V$instance;
Operation Steps
Log on to the host with an Oracle user.
Connect to the database.
% sqlplus "/as sysdba"
View the database character set.
Sql> Select Userenv (' language ') from dual;
The following information is displayed.
American_america. We8iso8859p1
View the database using the character set.
Sql> Select value from nls_database_parameters Where parameter= ' Nls_characterset ';
Modifies the database character set.
Close the database.
sql> shutdown immediate;
Start the database.
sql> startup Mount;
Modifies the character set.
sql> ALTER SESSION SET sql_trace=true;
sql> ALTER SYSTEM ENABLE RESTRICTED SESSION;
sql> ALTER SYSTEM SET job_queue_processes=0;
sql> ALTER SYSTEM SET aq_tm_processes=0;
sql> ALTER DATABASE OPEN;
Sql> set Linesize 120;
Sql> ALTER DATABASE character set Al32utf8;
Ora-12712:new character set must be a superset of the old character set
ERROR at line 1:
These errors can be ignored
Sql> ALTER DATABASE Character set Internal_use Al32utf8;
sql> ALTER SESSION SET sql_trace=false;
Restart database
sql> shutdown immediate;
Sql> STARTUP;
View the character set.
Sql> Select Userenv (' language ') from dual;
Displays the following information indicating that the modified character set was successful.
USERENV (' LANGUAGE ')
----------------------------------------------------
American_america. Al32utf8
Sql> Select value from nls_database_parameters Where parameter= ' Nls_characterset ';
Displays the following information indicating that the modified character set was successful.
VALUE
-------------
Al32utf8
Check if database tablespace is created
Select Tablespace_name, STATUS from Dba_tablespaces;
Database archiving mode
Select Log_mode from V$database;
To open the Database archive mode:
Close the database
sql> shutdown immediate;
Sql> exit
Restart the database to turn on archive mode.
Sqlplus "/as sysdba"
sql> startup Mount;
sql> ALTER DATABASE Archivelog;
sql> ALTER DATABASE open;
Check the Oracle database time zone
Sql> SELECT Dbtimezone from DUAL;
To modify the Oracle database time zone, restart the database
sql> ALTER DATABASE SET time_zone = ' Asia/shanghai ';
Sql> select * from V$timezone_names;
Show time after modification
Sql> Select To_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') from dual;
View database users.
Sql>select username from All_users;
Sql> drop user username cascade;
Modifies the default time zone for Oracle Auto-timer tasks.
Sql> exec dbms_scheduler. Set_scheduler_attribute (' Default_timezone ', ' Asia/shanghai ');
Modify the date format for Oracle.
Sql> alter system set nls_date_format= ' mm/dd/yyyy HH24:MI:SS ' scope=spfile;
Modify log-related parameters.
Modify the archive log file path.
Sql> alter system set db_recovery_file_dest= ' Scope=spfile;
Sql> alter system set log_archive_dest_1= ' Location=+dg_backup ' scope=spfile;
Modify the force log toggle settings.
Sql> alter system Set Archive_lag_target = 7200 scope = both;
Modifies the value of Log_buffer (in bytes).
Sql> alter system Set Log_buffer = 3145728 scope = SPFile;
The "Log_buffer" range is from 3M to 128M.
Modify database connection related parameters.
Modify the database connection mode.
Sql> alter system Set shared_servers = 0 scope=both;
Modify the number of open_link connections.
Sql> alter system set OPEN_LINKS=10 Scope=spfile;
Sql> alter system set OPEN_LINKS_PER_INSTANCE=10 Scope=spfile;
Close the database Recycle Bin.
Sql> alter system set Recyclebin=off Scope=spfile;
Modify other parameters.
Modify the "Sec_case_sensitive_logon" parameter to turn off the password-sensitive function.
Sql> alter system Set Sec_case_sensitive_logon = False scope=spfile;
Modify the database authentication parameters.
Sql> alter system Set Remote_login_passwordfile = EXCLUSIVE scope=spfile;
Sql> alter system set remote_listener= ";
Modify the Workarea_size_policy.
Sql> alter system set WORKAREA_SIZE_POLICY=AUTO scope = SPFile;
Modify the PRE_PAGE_SGA.
Sql> alter system Set PRE_PAGE_SGA = False scope = SPFile;
Close the database.
sql> shutdown immediate;
Sql> exit;
The database parameters that have been implemented for automatic configuration.
Log on as an Oracle user.
Edit the "Sqlnet.ora" file.
Create a new or modified "Sqlnet.ora" file.
% VI $ORACLE _home/network/admin/sqlnet.ora
Add the following content to the file:
Diag_adr_enabled=off
Modify the "deferred_segment_creation" parameter, and both the empty table and the non-empty table are assigned segment.
Sql> alter system set DEFERRED_SEGMENT_CREATION=FALSE Scope=spfile;
Modify the "optimizer_use_invisible_indexes" parameter so that the optimizer ignores "invisible index".
Sql> alter system Set optimizer_use_invisible_indexes = False scope=spfile;
Modify the "Audit_trail" parameter to turn off the database auditing function.
Sql> alter system set Audit_trail=none Scope=spfile;
Modify the "parallel_force_local" parameter.
Sql> alter system set parallel_force_local=true scope= SPFile;
Modify the "_gc_policy_time" parameter to turn off the DRM (Dynamic Resource mastering) feature.
Sql> alter system set "_gc_policy_time" =0 scope= spfile;
Modify the "cursor_sharing" related parameter to turn off the ACS (Adaptive cursor sharing) feature.
Sql> alter system set "_optimizer_extended_cursor_sharing_rel" =none scope= spfile;
Sql> alter system set "_optimizer_extended_cursor_sharing" =none scope = SPFile;
Sql> alter system set "_optimizer_adaptive_cursor_sharing" =false scope=spfile;
Modify the Open_cursors.
Sql> alter system Set Open_cursors = 480 scope = SPFile;
The value of "open_cursors" needs to be greater than or equal to 350.
Oracle Common Command Notes (1)