Restore a database in SQL Server 6.5 Version

  • seven.srikanth

    Ten Centuries

    Points: 1102

    Hi Guys,

    The backup file is in *.dat.gz which is a Gun Zip File.

    Please help me in Unzipping the file and then restoring it in Server.

    Source and destination are of Same versions.

  • SQLRNNR

    SSC Guru

    Points: 281079

    have you been able to at least successfully unzip the file?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • seven.srikanth

    Ten Centuries

    Points: 1102

    Atlast i was able to unzip the file using winzip..

    So please help me with the restore....

  • seven.srikanth

    Ten Centuries

    Points: 1102

    Database is also restored.. With Permissions....Thanks

  • Ninja's_RGR'us

    SSC Guru

    Points: 294069

    Easiest thread ever. All poster should be like that :-D.

  • Elliott Whitlow

    SSC Guru

    Points: 102296

    Yeah, really easy, apparently nothing left for us to do..

    CEWII

  • SQLRNNR

    SSC Guru

    Points: 281079

    seven.srikanth (8/5/2011)


    Database is also restored.. With Permissions....Thanks

    Good to hear

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • seven.srikanth

    Ten Centuries

    Points: 1102

    Hey guys... The thread is easiest but restoration went like a mission....

    After the Successful restoration the Customer gave me a Big Surprise Smile...

    txtPost_CommentEmoticon(':w00t:');

    Anyways I'm just documenting the stuff.. Will Post Here Once done...

    Thanks Guys

  • seven.srikanth

    Ten Centuries

    Points: 1102

    Step 1:

    Execute the Following in the database context where you need to pull those permissions, This will create a sp_showpermissions stored procedure.

    /****** Stored Procedure dbo.sp_showpermissions v 1.0 ******/

    CREATE PROCEDURE sp_showpermissions

    @group VARCHAR(30) = NULL

    AS

    SET NOCOUNT ON

    IF @group is NULL SELECT @group = 'public'

    IF EXISTS (SELECT name from sysusers where name = @group and uid = gid)

    BEGIN

    SET NOCOUNT OFF

    SELECT "ROLE NAME" = b.name,

    "OBJECT NAME" = c.name,

    "ACTION" = CASE a.action

    WHEN 26 THEN 'REFERENCES'

    WHEN 193 THEN 'SELECT'

    WHEN 195 THEN 'INSERT'

    WHEN 196 THEN 'DELETE'

    WHEN 197 THEN 'UPDATE'

    WHEN 198 THEN 'CREATE TABLE'

    WHEN 203 THEN 'CREATE DATABASE'

    WHEN 204 THEN 'GRANT_W_GRANT'

    WHEN 205 THEN 'GRANT'

    WHEN 206 THEN 'REVOKE'

    WHEN 207 THEN 'CREATE VIEW'

    WHEN 222 THEN 'CREATE PROCEDURE'

    WHEN 224 THEN 'EXECUTE'

    WHEN 228 THEN 'DUMP DATABASE'

    WHEN 233 THEN 'CREATE DEFAULT'

    WHEN 235 THEN 'DUMP TRANSACTION'

    WHEN 236 THEN 'CREATE RULE'

    END,

    "TYPE" = CASE c.type

    WHEN 'C' THEN 'C CHECK constraint'

    WHEN 'D' THEN 'D Default or DEFAULT constraint'

    WHEN 'F' THEN 'F FOREIGN KEY constraint'

    WHEN 'K' THEN 'K PRIMARY KEY or UNIQUE constraint'

    WHEN 'L' THEN 'L Log'

    WHEN 'P' THEN 'P Stored procedure'

    WHEN 'R' THEN 'R Rule'

    WHEN 'RF' THEN 'RF Stored procedure for replication'

    WHEN 'S' THEN 'S System table'

    WHEN 'TR' THEN 'TR Trigger'

    WHEN 'U' THEN 'U User table'

    WHEN 'V' THEN 'V View'

    WHEN 'X' THEN 'X Extended stored procedure'

    END

    FROM sysprotects a, sysusers b, sysobjects c

    WHERE a.uid = b.uid

    AND c.id = a.id

    AND b.name = @group

    ORDER BY b.name, c.name, a.action

    END

    ELSE

    BEGIN

    PRINT 'You did not provide a valid role name'

    PRINT ''

    SELECT 'Valid role names for the ' + db_name() + ' database are:'

    PRINT ''

    SELECT "Role Name"=name FROM sysusers WHERE uid = gid ORDER BY name

    PRINT ''

    PRINT ''

    PRINT 'Syntax: sp_showpermissions [role_name]'

    PRINT ''

    PRINT 'sp_showpermissions with no parameter will show permissions for public'

    END

    SET NOCOUNT OFF

    Step 2: Next, Script out the execute of the above script and give parameter as a role name. Repeate this with all the Roles. And save the results in Excel, which will reduce the post work to be done.

    Step 3: Next, Script the logins and roles using syslogins and sysusers, there is nothing you can be done here so everything is to be done normally. I’m not a TSQL Coder to code all this stuff. So, I had done all this manually and taken them in excel.

    FYI, now we will be having following information related to permissions.

    Logins.

    Logins and Roles associated.

    Roles and Object Permissions

    So we got the permissions.

    Step 4: Proceed with the Restore using the following command,

    LOAD DATABASE dbname

    FROM disk = ‘......dat’

    You will be done with the restoring the database, So now You need to proceed with the permissions.

    Step 5: With the stuff you have got in Excel, make sure you change the stuff that will execute in the Query window. And then execute in the order, that will create the users for logins first and then object permissiosns to roles. So now thats it, You are done... Trust me... The above script is so handy....

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply