Friday, October 9, 2009

Get table script

You can use this function dbms_metadata.get_ddl to generate the create script of your table.
SELECT dbms_metadata.get_ddl('TABLE', 'Your table', 'Your owner')
FROM dual;

Tuesday, October 6, 2009

Active Directory Maximum Limits - Scalability

Do you know the limitation of Active Directory? If not, please read this article Active Directory Maximum Limits - Scalability

Saturday, September 19, 2009

Get database status

SELECT DATABASEPROPERTYEX(db_name(), 'Status')

Return value:

ONLINE = Database is available for query.
OFFLINE = Database was explicitly taken offline.
RESTORING = Database is being restored.
RECOVERING = Database is recovering and not yet ready for queries.
SUSPECT = Database did not recover.
EMERGENCY = Database is in an emergency, read-only state. Access is restricted to sysadmin members

Thursday, September 17, 2009

Scaling an Oracle database: What is the best strategy for you?

I'm reading this article Scaling an Oracle database: What is the best strategy for you?

Tuesday, September 15, 2009

Get recovery model for the database.

SELECT DATABASEPROPERTYEX(db_name(), 'Recovery')
Return value:
FULL = Full recovery model
BULK_LOGGED = Bulk logged model
SIMPLE = Simple recovery model
Base data type: nvarchar(128)

Wednesday, September 9, 2009

Get all encrypted procedures


SELECT OBJECT_NAME(id) as ObjectName
FROM sys.syscomments
WHERE encrypted = 1

Encrypt stored procedure/ view/ function


CREATE PROCEDURE YourProcedureName
WITH ENCRYPTION
AS

CREATE VIEW YourViewName
WITH ENCRYPTION
AS

CREATE FUNCTION YourFunctionName()
RETURNS INT
WITH ENCRYPTION
AS

Thursday, September 3, 2009

Microsoft SharePoint Designer Team Blog : Locking Down SharePoint Designer

I'm reading Microsoft SharePoint Designer Team Blog : Locking Down SharePoint Designer

ENABLE/DISABLE

Change status of constraint or primary key in a table


ALTER TABLE DEPT
DISABLE CONSTRAINT DEPT_PRIMARY_KEY CASCADE;

Get running cursors and their queries


SELECT NVL(USERNAME,'SYSTEM PROC') USER_NAME, t2.SID,
SQL_TEXT
FROM v$open_cursor t1, v$session t2
WHERE t2.SQL_ADDRESS = t1.ADDRESS
AND t2.SQL_HASH_VALUE = t1.HASH_VALUE
ORDER BY 1