141. How to quickly compile all views?
SQL> spool view1. SQL
SQL> select 'alter view' | tname |'
Compile; 'from tab;
SQL> spool off
Then run view1. SQL.
SQL> @ view1. SQL;
142. Solutions for ORA-01555 snapshot too old
Increase the minextents value, increase the partition size, and set a high optimal value.
143. The rollback segment space required by the transaction is insufficient, as the tablespace is full (ORA-01560 error) and the rollback segment is extended
A solution for reaching the value of the maxextents parameter (ORA-01628.
Add a file to the tablespace of the rollback segment or make the existing file larger; Increase the value of maxextents.
144. How to encrypt Oracle stored procedures?
The following stored procedures are stored in the AA. SQL file:
Create or replace procedure testccb (I in number)
Begin
Dbms_output.put_line ('input parameter is '| to_char (I ));
End;
SQL> wrap INAME = A. SQL;
PL/SQL wrapper: Release 8.1.7.0.0-production on TUE Nov 27 22:26:48 2001
Copyright (c) Oracle Corporation 1993,200 0. All rights reserved.
Processing AA. SQL to AA. PLB
Run AA. PLB
SQL> @ AA. PLB;
145. How to monitor the waiting of cases?
Select event, sum (decode (wait_time, 0, 0, 1) "Prev ",
Sum (decode (wait_time, 0, 0) "curr", count (*) "tot"
From v $ session_wait
Group by event order by 4;
146. How do I roll back the contention of segments?
Select name, waits, gets, Waits/gets "ratio"
From v $ rollstat C, V $ rollname d
Where C. USN = D. USN;
147. How to monitor the I/O ratio of a tablespace?
Select B. tablespace_name name, B. file_name "file", A. phyrds Pyr, A. phyblkrd PBR,
A. phywrts pyw, A. phyblkwrt PBW
From v $ filestat A, dba_data_files B
Where a. File # = B. file_id
Order by B. tablespace_name;
148. How to monitor the I/O ratio of a file system?
Select substr (C. File #, 1, 2) "#", substr (C. Name, 1, 30) "name", C. Status, C. bytes,
D. phyrds, D. phywrts
From v $ datafile C, V $ filestat d
Where C. File # = D. File #;
149. How can I find all indexes under a user?
Select user_indexes.table_name, user_indexes.index_name, uniqueness,
Column_name
From user_ind_columns, user_indexes
Where user_ind_columns.index_name = user_indexes.index_name
And user_ind_columns.table_name = user_indexes.table_name
Order by user_indexes.table_type, user_indexes.table_name,
User_indexes.index_name, column_position;
150. How to monitor the SGA hit rate?
Select a. Value + B. Value "logical_reads", C. Value "phys_reads ",
Round (100 * (A. Value + B. Value)-C. Value)/(A. Value + B. Value) "buffer hit ratio"
From v $ sysstat A, V $ sysstat B, V $ sysstat C
Where a. Statistic # = 38 and B. Statistic # = 39
And C. Statistic # = 40;
151. How to monitor the hit rate of the Dictionary Buffer in SGA?
Select parameter, gets, getmisses, getmisses/(gets + getmisses) * 100 "miss ratio ",
(1-(sum (getmisses)/(sum (gets) + sum (getmisses) * 100 "hit ratio"
From v $ rowcache
Where gets + getmisses <> 0
Group by parameter, gets, getmisses;
152. How to monitor the hit rate of the shared cache in SGA, which should be less than 1%?
Select sum (PINs) "Total Pins", sum (reloads) "Total reloads ",
Sum (reloads)/sum (PINs) * 100 libcache
From v $ librarycache;
Select sum (pinhits-reloads)/sum (PINs) "Hit Radio", sum (reloads)/sum (PINs) "reload
Percent"
From v $ librarycache;
153. How to display the category and size of all database objects?
Select count (name) num_instances, type, sum (source_size) source_size,
Sum (parsed_size) parsed_size, sum (code_size)
Code_size, sum (error_size) error_size,
Sum (source_size) + sum (parsed_size) + sum (code_size)
+ Sum (error_size) size_required
From dba_object_size
Group by type order by 2;
154. Monitor the log cache hit rate in SGA, which should be less than 1%
Select name, gets, misses, immediate_gets, immediate_misses,
Decode (gets, 100, misses/gets *) ratio1,
Decode (immediate_gets + immediate_misses, 0, 0,
Immediate_misses // (immediate_gets + immediate_misses) * 100) ratio2
From v $ latch where name in ('redo allocation', 'redo copy ');
155. Monitor the sorting ratio of memory to hard disk, preferably make it smaller than. 10, increase sort_area_size
Select name, value from V $ sysstat where name in ('sorts (memory )',
'Sorts (Disk )');
156. How to monitor who is running what SQL statements in the current database?
Select osuser, username, SQL _text from V $ session A, V $ sqltext B
Where a. SQL _address = B. Address order by address, piece;
157. How to monitor the Dictionary Buffer?
Select (sum (pins-reloads)/sum (PINs) "lib cache" from V $ librarycache;
Select (sum (gets-getmisses-usage-fixed)/sum (gets) "Row cache"
From v $ rowcache;
Select sum (PINs) "executions", sum (reloads) "cache misses while
Executing "from V $ librarycache;
The latter is divided by the former. This ratio is less than 1%, and it is better to close to 0%.
Select sum (gets) "dictionary gets", sum (getmisses) "dictionary Cache
Get misses"
From v $ rowcache
158. Monitor MTS
Select busy/(busy + idle) "shared servers busy" from V $ dispatcher;
When the value is greater than 0.5, the parameter must be increased.
Select sum (wait)/sum (totalq) "dispatcher waits" from V $ queue where
Type = 'dispatcher ';
Select count (*) from V $ dispatcher;
Select servers_highwater from V $ Mts;
When servers_highwater is close to mts_max_servers, increase the Parameter
159. How do I know the ID of the current user?
SQL> show user;
Or SQL> Select User from dual;
160. How to View tables with high fragmentation levels?
Select segment_name table_name, count (*) extents
From dba_segments where owner not in ('sys ', 'system') group
Segment_name
Having count (*) = (select max (count (*) from dba_segments group
Segment_name );
162. How do I know the storage of tables in the tablespace?
Select segment_name, sum (bytes), count (*) ext_quan from dba_extents where
Tablespace_name = '& tablespace_name' and segment_type = 'table' group
Tablespace_name, segment_name;
163. How do I know the storage of indexes in the tablespace?
Select segment_name, count (*) from dba_extents where segment_type = 'index' and
Owner = '& owner'
Group by segment_name;
164. How do I know user sessions with many CPUs?
11 is CPU used by this session
Select a. Sid, spid, status, substr (A. Program, 1, 40) prog, A. Terminal, osuser, value/60/100
Value
From v $ session A, V $ process B, V $ sesstat C
Where C. Statistic # = 11 and C. Sid = A. Sid and A. paddr = B. ADDR order by value DESC;
165. How do I know the listener log file?
Take 8i as an Example
$ ORACLE_HOME/Network/log/listener. Log
166. How do I know the listener parameter file?
Take 8i as an Example
$ ORACLE_HOME/Network/admin/listener. ora
167. How do I know the TNS connection file?
Take 8i as an Example
$ ORACLE_HOME/Network/admin/tnsnames. ora
168. How do I know SQL * Net Environment files?
Take 8i as an Example
$ ORACLE_HOME/Network/admin/sqlnet. ora
169. How do I know the warning log file?
Take 8i as an Example
$ ORACLE_HOME/admin/SID/bdump/sidalrt. Log
170. How do I know the basic structure?
Take 8i as an Example
$ ORACLE_HOME/rdbms/admin/standard. SQL
171. How do I know how to create a data dictionary view?
Take 8i as an Example
$ ORACLE_HOME/rdbms/admin/CATALOG. SQL
172. How do I know how to create a data dictionary view for auditing?
Take 8i as an Example
$ ORACLE_HOME/rdbms/admin/cataudit. SQL
173. How do I know how to create a data dictionary view for a snapshot?
Take 8i as an Example
$ ORACLE_HOME/rdbms/admin/catsnap. SQL
SQL statement Optimization Method
174./* + all_rows */
It indicates that the overhead-based optimization method is selected for the statement block, and the optimal throughput is obtained to minimize the resource consumption.
For example:
Select/* + all + _ rows */emp_no, emp_nam, dat_in from bsempms where
Emp_no = 'ccbzzp ';
175./* + first_rows */
It indicates that the overhead-based optimization method is selected for the statement block and the optimal response time is obtained to minimize the resource consumption.
For example:
Select/* + first_rows */emp_no, emp_nam, dat_in from bsempms
Where emp_no = 'ccbzzp ';
176./* + choose */
It indicates that if the data dictionary contains the statistics of the Access Table, the overhead-based optimization method is used to obtain the best
Spit;
It indicates that if no statistical information of the Access Table is found in the data dictionary, the rule overhead-based optimization method is used;
For example:
Select/* + choose */emp_no, emp_nam, dat_in from bsempms where
Emp_no = 'ccbzzp ';
177./* + rule */
Indicates the rule-based Optimization Method for the statement block.
For example:
Select/* + rule */emp_no, emp_nam, dat_in from bsempms where
Emp_no = 'ccbzzp ';
178./* + full (table )*/
Indicates the method used to globally scan the table.
For example:
Select/* + full (a) */emp_no, emp_nam from bsempms A where
Emp_no = 'ccbzzp ';
179./* + rowid (table )*/
The prompt explicitly indicates that the specified table is accessed Based on rowid.
For example:
Select/* + rowid (bsempms) */* From bsempms where
Rowid> = 'aaaaaaaaaaaaa'
And emp_no = 'ccbzzp ';
180./* + Cluster (table )*/
The prompt clearly indicates the access method for the selected cluster scan for the specified table, which is only valid for the cluster object.
For example:
Select/* + cluster */bsempms. emp_no, dpt_no from bsempms, bsdptms
Where dpt_no = 'tec304 'and bsempms. dpt_no = bsdptms. dpt_no;
181./* + index (Table index_name )*/
Indicates the method used to scan the selected index on the table.
For example:
Select/* + index (bsempms sex_index) Use sex_index because there are
Fewmale bsempms */from bsempms where sex = 'M ';
182./* + index_asc (Table index_name )*/
Indicates the method used to scan the index in ascending order.
For example:
Select/* + index_asc (bsempms pk_bsempms) */from bsempms where
Dpt_no = 'ccbzzp ';
183./* + index_combine */
Select a bitmap access path for the specified table. If index_combine does not provide an index as a parameter
Select
Boolean combination.
For example:
Select/* + index_combine (bsempms sal_bmi hiredate_bmi) */* from
Bsempms
Where Sal <5000000 and hiredate <sysdate;
184./* + index_join (Table index_name )*/
It is prompted that the command optimizer uses the index as the access path.
For example:
Select/* + index_join (bsempms sal_hmi hiredate_bmi) */SAL, hiredate
From bsempms where Sal <60000;
185./* + index_desc (Table index_name )*/
Indicates the method used to scan the table in descending order of indexes.
For example:
Select/* + index_desc (bsempms pk_bsempms) */from bsempms
Where dpt_no = 'ccbzzp ';
186./* + index_ffs (Table index_name )*/
Perform a quick full index scan on the specified table, instead of a full table scan.
For example:
Select/* + index_ffs (bsempms in_empnam) */* From bsempms where
Dpt_no = 'tec305 ';
187./* + add_equal table index_nam1, index_nam2 ,...*/
The prompt is to clearly select the execution plan and combine the scanning of Several Single Column indexes.
For example:
Select/* + index_ffs (bsempms in_dptno, in_empno, in_sex) */* from
Bsempms where emp_no = 'ccbzzp' and dpt_no = 'tdc306 ';
188./* + use_concat */
Convert the or condition following the WHERE clause in the query to the Union all clause.
For example:
Select/* + use_concat */* From bsempms where dpt_no = 'tdc506 'and
Sex = 'M ';
189./* + no_expand */
For the or in-list query statement after where, no_expand will prevent it from being based on the optimizer
Extend it.
For example:
Select/* + no_expand */* From bsempms where dpt_no = 'tdc506 'and
Sex = 'M ';
190./* + nowrite */
Query Rewriting of query blocks is prohibited.
191./* + rewrite */
You can use a view as a parameter.
192./* + Merge (table )*/
Allows you to merge queries in a view.
For example:
Select/* + Merge (v) */a. emp_no, A. emp_nam, B. dpt_no from bsempms
(Selet dpt_no, AVG (SAL) as avg_sal from bsempms B group by dpt_no) V where
A. dpt_no = V. dpt_no and A. SAL> v. avg_sal;
193./* + no_merge (table )*/
Views that can be merged are not merged.
For example:
Select/* + no_merge (v) */a. emp_no, A. emp_nam, B. dpt_no from bsempms
A (selet dpt_no, AVG (SAL) as avg_sal from bsempms B group by dpt_no) V
Where a. dpt_no = V. dpt_no and A. SAL> v. avg_sal;
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