Saturday, August 18, 2012

Clustered and Non-Clustered Index in SQL

Visit the Below Website to access unlimited exam questions for all IT vendors and Get Oracle Certifications for FREE
http://www.free-online-exams.com


When you first create a new table, there is no index created by default. In technical terms, a table without an index is called a "heap". As you would expect, the data we will insert into the table will be returned in the same order. A non-clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a non-clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.


A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.


Clustered index is good when you know in which order you will be returning the records in most cases. You can create clustered index and after that you don't need to use ORDER BY statement. This will be much more faster. If the order is not important for you and will not create clustered index by yourself, then primary key will be clustered index by default. There is nothing bad not to have the clustered index, it can speed up inserting rows.



You can access www.free-online-exams.com for the whole latest version of the exam



Get Oracle Certifications for all Exams
Free Online Exams.com

Thursday, August 16, 2012

Alter Schema in SQL Server, how to move a table, such as ABC_table, from its current scheme (scheme1) to another scheme (scheme2)

Visit the Below Website to access unlimited exam questions for all IT vendors and Get Oracle Certifications for FREE
http://www.free-online-exams.com

ALTER SCHEMA schema2 TRANSFER schema1.ABC_table;

ALTER SCHEMA can only be used to move securables between schemas in the same database.
To change or drop a securable within a schema, use the ALTER or DROP statement specific to
that securable.

You can access www.free-online-exams.com for the whole latest version of the exam


Get Oracle Certifications for all Exams
Free Online Exams.com

How to allow users on SQL Server to use the OPENROWSET() function to search remote information sources.

Visit the Below Website to access unlimited exam questions for all IT vendors and Get Oracle Certifications for FREE
http://www.free-online-exams.com
01. sp_configure 'show advanced options', 1
02. RECONFIGURE
03.sp_configure 'Ad Hoc Distributed Queries', 1
04. RECONFIGURE
05. GO
06.
07. SELECT a.*
08. FROM OPENROWSET('SQLNCLI', 'Server=Madrid;Trusted_Connection=yes;',
09. 'SELECT GroupName, Name, DepartmentID
10. FROM AdventureWorks.HumanResources.Department
11. ORDER BY GroupName, Name') AS a;
12. GO


By default, SQL Server does not allow ad hoc distributed queries using OPENROWSET and
OPENDATASOURCE. When this option is set to 1, SQL Server allows ad hoc access. When this
option is not set or is set to 0, SQL Server does not allow ad hoc access.

Ad hoc distributed queries use the OPENROWSET and OPENDATASOURCE functions to
connect to remote data sources that use OLE DB. OPENROWSET and OPENDATASOURCE
should be used only to reference OLE DB data sources that are accessed infrequently. For any
data sources that will be accessed more than several times, define a linked server.


You can access www.free-online-exams.com for the whole latest version of the exam



Get Oracle Certifications for all Exams
Free Online Exams.com

ALTER LOGIN CHECK_POLICY = { ON | OFF }

Visit the Below Website to access unlimited exam questions for all IT vendors and Get Oracle Certifications for FREE
http://www.free-online-exams.com
If you have the following below requirements:

1. SQL Server 2008 logins must have the same password complexity rules which are enforced by
Windows Server for authentication.

2. Full compliance of all users with regarding to adhering to the password complexity rules


Answer:

Applies only to SQL Server logins. Specifies that the Windows password policies of the computer
on which SQL Server is running should be enforced on this login. The default value is ON.

ALTER LOGIN CHECK_POLICY = { ON | OFF }

You should consider using the ALTER LOGIN ... CHECK_POLICY = ON statement to change
the entire login of all users.

Create a policy using Policy-Based Management that matches the requirements

Policy-Based Management is a system for managing one or more instances of SQL Server 2008.
When SQL Server policy administrators use Policy-Based Management, they use SQL Server
Management Studio to create policies to manage entities on the server, such as the instance of
SQL Server, databases, or other SQL Server objects.

You can access www.free-online-exams.com for the whole latest version of the exam



Get Oracle Certifications for all Exams
Free Online Exams.com

Wednesday, March 7, 2012

How to find out the SQL with most redo log generation

Visit the Below Website to access unlimited exam questions for all IT vendors and Get Oracle Certifications for FREE
http://www.free-online-exams.com

To find sessions generating lots of redo, you can use either of the following methods. Both methods examine the amount of undo generated. When a transaction generates undo, it will automatically generate redo as well.
We can query Query V$SESS_IO. This view contains the column BLOCK_CHANGES which indicates how much blocks have been changed by the session. High values indicate a session generating lots of redo.

SELECT s.sid, s.serial#, s.username, s.program,
i.block_changes
FROM v$session s, v$sess_io i
WHERE s.sid = i.sid
ORDER BY 5 desc, 1, 2, 3, 4;

We need to run the query multiple times and examine the delta between each occurrence of BLOCK_CHANGES. Large deltas indicate high redo generation by the session.

This just give me an idea about what is currently happening. But I want more historical information. Let us say for last 3 days, what was the SQLs involed in most redo.
I did generate an AWR for last two days but that did not gave me the information that I was looking for. So I decided to directly query DBA_HIST views.

I found a way to get the hostorical db block change information from DBA_HIST views. dba_hist_seg_stat view has a column called db_block_changes_delta column. We can query this view and find out the sum of block changes per object.

SELECT dhso.object_name,
sum(db_block_changes_delta)
FROM dba_hist_seg_stat dhss,
dba_hist_seg_stat_obj dhso,
dba_hist_snapshot dhs
WHERE dhs.snap_id = dhss.snap_id
AND dhs.instance_number = dhss.instance_number
AND dhss.obj# = dhso.obj#
AND dhss.dataobj# = dhso.dataobj#
AND begin_interval_time BETWEEN to_date('2011_05_25 08′,'YYYY_MM_DD HH24′) AND to_date('2011_05_27 00′,'YYYY_MM_DD HH24′)
GROUP BY dhso.object_name
order by sum(db_block_changes_delta) desc
/

WINDOW_EVENTS 809200
WINDOWS 153968
HISTGRM$ 65040
I_H_OBJ#_COL# 61168
MODEL_REPORT 31840
DATA_PROCESS 16784
RULE_EXECUTE_INFO 12448
PK_MODEL_REPR 9088

Above query gives the sum(db_block_changes_delta). Now we can use dba_hist_sqlstat view to get the SQL statements. So I did run another query to see what SQLs are run on WINDOW_EVENTS or WINDOW during same period.

SELECT distinct dbms_lob.substr(sql_text,4000,1),
FROM dba_hist_sqlstat dhss,
dba_hist_snapshot dhs,
dba_hist_sqltext dhst
WHERE upper(dhst.sql_text) LIKE '%WINDOW%'
AND dhss.snap_id=dhs.snap_id
AND dhss.instance_Number=dhs.instance_number
AND dhss.sql_id = dhst.sql_id and rownum<2;

INSERT INTO WINDOWS (
EVENT_ID,
DATA_PROCESS_ID,
EVENT_TIME,
DENOMINATOR_STR,
TIME_WINDOW_ID,
TIME_WINDOW_PANE,
OWNER_ORG_ID
)

INSERT INTO WINDOW_EVENTS (
EVENT_ID ,
DATA_PROCESS_ID ,
EVENT_TIME ,
EVENT_EPOCH_TIME ,
OWNER_ORG_ID ,
DENOMINATOR_STR
)

This is just the part of the output. There was a lot this insert during that same period. Now I know which SQL was actually generating a lot of redo log.

Get Oracle Certifications for all Exams
Free Online Exams.com

Which Sessions Generating Lots of Redo logs in oracle

Visit the Below Website to access unlimited exam questions for all IT vendors and Get Oracle Certifications for FREE
http://www.free-online-exams.com
Using below query, we can easily identify which session/transaction generating more redo logs.

Query 1:

V$Sess_io & V$Session

SELECT s.sid, s.serial#, s.username, s.program,
i.block_changes
FROM v$session s, v$sess_io i
WHERE s.sid = i.sid
ORDER BY 5 desc;

BLOCK_CHANGES column shows how much blocks have been changed the session.

Query 2:

Below query shows the amount of undo blocks & undo records accessed by the transaction.


SELECT s.sid, s.serial#, s.username, s.program, 
t.used_ublk, t.used_urec
FROM v$session s, v$transaction t
WHERE s.taddr = t.addr
ORDER BY 5,6 desc;
Get Oracle Certifications for all Exams
Free Online Exams.com

Saturday, March 3, 2012

No Cancellation Notification Received

Visit the Below Website to access unlimited exam questions for all IT vendors and Get Oracle Certifications for FREE
http://www.free-online-exams.com

Problem: No Cancellation Notification Received



Solution:




No Cancellation Notification Received
• Please upload manually $FND_TOP/patch/115/xml/US/wfstde.wfx using WFXLOAD:

EXAMPLE

. APPSORA.env

cd $FND_TOP/patch/115/xml/US

jre oracle.apps.fnd.wf.WFXLoad -u apps apps_pwd \
host..com:1501:db_sid thin \
US wfstde.wfx

Root Cause:

Pre wfstde.wfx Manual Upload:

SQL> select name, generate_function from wf_events where name = 'oracle.apps.wf.notification.cancel';


NAME
-----------------------------------------------------------------------
oracle.apps.wf.notification.cancel

GENERATE_FUNCTION
-------------------------------------


Post wfstde.wfx Manual Upload:


SQL> connect apps/apps@orlaol-11i
Connected.
SQL> /

NAME
-----------------------------------------------------------------------
oracle.apps.wf.notification.cancel

GENERATE_FUNCTION
-------------------------------------
WF_XML.Generate



References:


Java Mailer and Other 11.5.9/OWF G Current Issues in Applications 11i [ID 260393.1]
Get Oracle Certifications for all Exams
Free Online Exams.com