Thursday, November 15, 2007

Three typical maintenance queries for SQL Server vs Oracle

1. How to get the name of user currently connected to the engine?

MSSQL: SELECT SYSTEM_USER

Oracle: select user from dual

2. How to list schemas/databases available to user currently connected to the engine?

MSSQL: sp_helpdb

Oracle: SELECT * FROM ALL_USERS

3. How to retrieve the size of selected schema/database?

MSSQL: look at the column [db_size] returned by sp_helpdb

Oracle: select Sum(bytes) from dba_segments where owner=SCHEMANAME group by tablespace_name,owner

No comments: