Session level query:
SELECT * from v$session_wait where Wait_class <> ' Idle '; --> SID
SELECT * from V$session; --> sql_id/prev_sql_id
SELECT * FROM V$sql--> sql_text
SELECT * from V$session_event; --> specific SID has those wait affairs
Turn from: http://www.cnblogs.com/chay1227/archive/2013/03/17/2964020.html
Turn from: http://blog.csdn.net/allen879/article/details/40461227
Turn from: http://blog.itpub.net/28912557/viewspace-776770/
As a result of the project needs, the original
Write a simple stored procedure right when practicing
Create or replace package Mahanpack asType my_cursor is REF CURSOR;End Mahanpack;-------------------------------------
Create or Replace package body Pageutil isProcedure GetResults (TableName
Excerpt from: http://ben-sin.iteye.com/blog/74661
The INTERSECT operator merges two queries, returns the records that exist in two queries, and returns the intersection of two query results, provided that the number of columns in two queries
SELECT emp_name, Dept_name FORM Employee, Department
WHERE employee.emp_deptid (+) = Department.deptid
This SQL text uses a right connection, where the other side of the "(+)" Location is the direction of the connection.
(1) Oracle left-Join in
See what locks the database has
Select Sess.sid,sess.serial#,Lo.oracle_username,Lo.os_user_name,Ao.object_name,Lo.locked_modeFrom V$locked_object Lo,Dba_objects AO,V$session Sesswhere ao.object_id = lo.object_id and lo.session_id = Sess.sid;
(The following content is valid only in the case of "=", like not.) )
Sometimes we do not want to query the lower or upper and other functions and the contents of the case are queried, such as from SQL Server, MySQL and other transfer to Oracle. The
1, to determine whether the table exists
select count (*) as v_cnt from user_tables where table_name= ' table '
2, get all the fields
in the datasheet Select
table_name,column_name from all_tab_columns where table_name = ' table '
3, creating
For RowNum, he's an Oracle system. The sequence is assigned to the number returned by the query, the
first row is assigned 1, and the second row is 2 and so on. This pseudo field
can be used to limit the total number of rows returned
Demand:1 According to the information in the Customer information table to compare the corresponding balance.The 2 table has the customer number, the balance, the partition information at each point in time, and the unique customer number in each
Syntax for SQL Server:SELECT TOP number|percent column_name (s) from table_nameMySQL syntaxSELECT column_name (s) from Table_namelimit numberExampleSELECT *from Personslimit 5Oracle syntaxSELECT column_name (s) from Table_namewhere ROWNUM
MysqlDROP TABLE IF EXISTS ' order ';CREATE TABLE ' order ' (' id ' int (one) not NULL auto_increment,' number ' varchar (255) Not NULL COMMENT ' ticket No. ',' applicant ' varchar (255) Not NULL COMMENT ' ticket Applicant ',' state ' int (1) is not
1: View current tablespace (tablespace)Select Tablespace_name from Dba_data_files order by Tablespace_name;Execution results1: System tablespace: Data used to hold internal tables and data dictionaries for Oracle systems, such as table names, column
sgasql> show parameter sga_targetname TYPE value------------------------------------ --------------------------------- ------------------ ------------sga_target
Create User Sql> create user tpcc identified by tpcc default tablespace tpcc temporary tablespace temp; User created. sql> set line 200sql> col username for a30sql> col Account_status for a20sql> select username,account_status,created from dba_
A user who needs to be queried to log on to Oracle (if a) B is the user who wants to query the table under the A userTwo execution query statements: Select ' Grant Select on A. ' | | Tname | | ' to B; ' from Tab;The simulation results are as follows:
有时候建立索引的时候不走索引,排除了字段数据问题和sql写法问题之外,应该是统计信息有问题,得重新收集。一:解锁统计信息为了稳定执行计划,一般统计信息都会被锁住的,在更新统计信息的时候得先解锁。①按用户schema解锁:EXEC DBMS_STATS.UNLOCK_schema_STATS(‘user_name‘);②按表模式解锁:先查出被锁定的表select table_name from user_tab_statistics where stattype_locked is not
Sql> shutdown immediatesql> startup mountsql> alter system set log_archive_dest_1= ' location=/u01/app/oracle/archive/ mandatory '; Sql> alter system set log_archive_dest_2= ' location=/u02/app/oracle/archive/ Optional ';
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