Thursday, April 8, 2010

Dynamic management view

You are managing a database that contains a table with several indexes. You notice that data modification performance has degraded over time. You suspect that some of the indexes are unused. You need to identify which indexes were not used by any queries since the last time SQL Server 2005 started. Which dynamic management view should you use?

A. sys.dm_fts_index_population
B. sys.dm_exec_query_stats
C. sys.dm_db_index_usage_stats
D. sys.dm_db_index_physical_stats

Answer: [C]
Highlight to find out the answer.

#Oracle #quiz

Examine the structure of CONTACT table.
CONTACT(CONTACT_ID NOT NULL NUMBER(3)
, NAME NOT NULL VARCHAR2(25)
, PHONE NOT NULL VARCHAR2(9)
, ADDRESS VARCHAR2(50))
There are hundred records in the contact table. You need to modify the Phone
column to hold only numeric value. Which statement will modify the data type of
the Phone column?

A. ALTER TABLE CONTACT MODIFY PHONE NUMBER(9)
B. ALTER CONTACT TABLE MODIFY COLUMN PHONE NUMBER(9);
C. You can not modify a VARCHAR2 data type to a NUMBER data type.
D. You cannot modify the data type of a column if there is data in the column.

Answer: [D]
Highlight to find out the answer.

Wednesday, April 7, 2010

Oracle quiz

You need to analyze how long your employees are working for your company from the
date that they are hired to the end of quarter 1/2010. To do this you must create
a report that displays the employee id, employee name, hire date, and the number
of months in whole numbers from the hired date to 03/31/2010. Which statement
produces the required results?

A. SELECT empid, empname, hired_date, ROUND(MONTHS_BETWEEN
('03/31/2010',hired_date)) "Time Taken" FROM emp;
B. SELECT empid, empname, hired_date,ROUND(DAYS_BETWEEN
('03/31/2010',hired_date))/30 FROM emp;
C. SELECT empid, empname, hired_date,
ROUND OFF('03/31/2010'-hired_date) "Time Taken" FROM emp;
D. SELECT empid, empname, hired_date, MONTHS_BETWEEN('03/31/2010',hired_date)
"Time Taken" FROM emp;

Answer:[A]
Highlight to find out the answer.

Monday, April 5, 2010

Check SMTP support SSL or TLS

Open Windows Command Line, type: telnet your.exchange.server.address 25
When connecting, type: ehlo your.hostname
You should now see few lines.
If there is STARTTLS line, then it means, that TLS is available.

Saturday, April 3, 2010

#Oracle error handling

DECLARE
 vErrorCode NUMBER;
 vErrorMsg VARCHAR2(200);
 vCurrentUser VARCHAR2(8);
 vInfo VARCHAR2(100)
BEGIN
 /*Some code processes*/
EXCEPTION
 WHEN OTHERS THEN
  vErrorCode:= SQLCODE;
  vErrorMsg := SQLERRM;
  vCurrentUser := USER;
  vInfo := 'Error encountered on ' || TO_CHAR(SYSDATE) || ' by database user ' || vCurrentUser;
  INSERT INTO LOG_TABLE(CODE, MSG, INFO)
  VALUES(vErrorCode, vErrorMsg, vInfo);
END;

Friday, April 2, 2010

#Oracle quiz

The contact table contains these columns:
First_Name VARCHAR2(25)
Sales_Commission NUMBER(3,2)
Evaluate this SQL statement
SELECT first_name,commission
FROM Contact
WHERE commission= (SELECT Sales_Comission FROM Contact
WHERE UPPER(first_name)= 'Bill')
Which statement below will cause this statement to fail?

A. Bill has a null salescommission resolution.
B. Bill has a zero sales commission resolution.
C. There is no contact with the first name Bill.
D. The first name values in the database are in the lower case.

Answer: [A]
Highlight to find out the answer.

#DBCC CHECK...

A power failure occurs on the storage area network (SAN) where your SQL Server 2005
database server is located. You need to check the allocation as well as the structural and logical integrity of all databases, including their system catalogs. What should you do?

A. Execute DBCC CHECKFILEGROUP for each filegroup.
B. Execute DBCC CHECKCATALOG.
C. Execute DBCC CHECKDB.
D. Execute DBCC CHECKTABLE for each table.

Answer:[C]
Highlight to find out the answer.

Thursday, April 1, 2010

Pligg message table

This table contains messages sent to users.
CREATE TABLE `pligg_messages` (
`idMsg` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`body` text COLLATE utf8_unicode_ci,
`sender` int(11) NOT NULL DEFAULT '0',
`receiver` int(11) NOT NULL DEFAULT '0',
`senderLevel` int(11) NOT NULL DEFAULT '0',
`readed` int(11) NOT NULL DEFAULT '0',
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`idMsg`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;