Followers

Tuesday, March 17, 2020

Commands which will be useful for Administrator tasks

First of all, whenever we work on Hyperion infra tasks, some times we may get requirement to work on Database. For example, while doing configuration, or migrations, or for any tasks relared to. So, one my colleague and friend, suggested list of tasks, queries, and how to check them on SQL Server Database.

Speacial Thanks to Vijay Darshanala, MSSQL DBA
https://www.linkedin.com/in/vijay-darshanala-12621673/

SQL Commands:

To check Snapshot and Read_committed status:
select name
         snapshot_isolation_state
        , snapshot_isolation_state_desc
        , is_read_committed_snapshot_on
        , recovery_model
        , recovery_model_desc
        , collation_name
    from sys.databases;

To Create view as table:

SELECT *
INTO NewTableName
FROM TableOrViewName

To know SQL Version
select @@version

To find the backup percentage and estimated time:
SELECT
    session_id,
    start_time,
    status,
    command,
    percent_complete,
    estimated_completion_time,
    estimated_completion_time /60/1000 as estimate_completion_minutes,
    --(select convert(varchar(5), getdate(),8)),
    DATEADD(n,(estimated_completion_time /60/1000),GETDATE()) as estimated_completion_time
FROM sys.dm_exec_requests where command = 'BACKUP DATABASE' OR command = 'RESTORE DATABASE'

Table backup:
Select * INTO BackUP_TABLE from Table_TO_BE_BACKUP;

Backup Process:
You can take backup with compression backup option, so in this way back file will come in compression mode, size will be less comparatively normal backup.

Go to Tasks -> Backup -> Options -> Set Backup Compression option to Compression backup from default.






No comments:

Post a Comment