Friday, June 28, 2013

[MS SQL Server] Restore database

[MS SQL Server] Restore database


Restore database

Posted: 28 Jun 2013 04:00 AM PDT

We do weekend full backup, daily differential, and hourly transcation log backup.Do I need to do a full backup right after I restore a database (for example , from production to a test server?) so that the backup chain can be consistent, Or I don't really, in case we want to restore database later, I just need use the full backup of the database that I used to restore and then use differential and transaction log backup?But I found at least from SSMS UI, if you want to restore to point of time, in the listed backup there is no one that I copied from prodution.Thanks

EXEC xp_cmdshell error

Posted: 28 Jun 2013 02:57 AM PDT

So I am trying to run a powershell script in SQL Management Studios: netsh advfirewall firewall add rule name="SQL_Admin_IPs" dir=in action=allow protocol=TCP localport=any profile=any enable= yes remoteip="127.0.0.1,127.0.0.2,127.0.0.3" exit-pssession set-item wsman:\localhost\Client\TrustedHosts -value 127.0.0.2 -force $pw = convertto-securestring -AsPlainText -Force -String P@$$word $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "administrator",$pw $session = new-pssession -computername 127.0.0.2 -credential $cred invoke-command -script {netsh advfirewall firewall add rule name="SQL_Admin_IPs" dir=in action=allow protocol=TCP localport=any profile=any enable=yes remoteip="127.0.0.1,127.0.0.2,127.0.0.3"} -session $session exit-pssession $session set-item wsman:\localhost\Client\TrustedHosts -value 127.0.0.3 -force $pw2 = convertto-securestring -AsPlainText -Force -String P@$$word $cred2 = new-object -typename System.Management.Automation.PSCredential -argumentlist "administrator",$pw2 $session2 = new-pssession -computername 127.0.0.3 -credential $cred2 invoke-command -script {netsh advfirewall firewall add rule name="SQL_Admin_IPs" dir=in action=allow protocol=TCP localport=any profile=any enable=yes remoteip="127.0.0.1,127.0.0.2,127.0.0.3"} -session $session2 exit-pssession $session2 It runs the first part of the script but it errors out when attempting the second part of the script:----------------------------------------------------------------------------------------------------------------------new-pssession : [127.0.0.2] Connecting to remote server 127.0.0.2 failed with the following error message : WinRM cannot process the request. The following error with errorcode 0x8009030d occurred while using Negotiate authentication: A specified logon session does not exist. It may already have been terminated. Possible causes are: -The user name or password specified are invalid. -Kerberos is used when no authentication method and no user name are specified. -Kerberos accepts domain user names, but not local user names. -The Service Principal Name (SPN) for the remote computer name and port does not exist. -The client and remote computers are in different domains and there is no trust between the two domains. After checking for the above issues, try the following: -Check the Event Viewer for events related to authentication. -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.----------------------------------------------------------------------------------------------------------------------At my wits end with this thing. I have scoured the interwebs but can't seem to find anything that pertains to this. Any help would be appreciated.Using SQL Server 2008

Dreaded Documentation.

Posted: 28 Jun 2013 01:44 AM PDT

Its that dreaded time. The IT manager just handed me a long list of of all the servers that are probably running SQL and wants me to get him some basic documentation. Is anyone aware of a tool that can automagically work through a list of severs and record server/instance/db information to a central management server. I've looked a few offerings and they don't offer everything i want. Either they just work per instance or db, or they just export to a doc or flat file. I'm not interested in some fancy word/html/excel output just return the results to a db to report on demand.

buffer latch Issues

Posted: 27 Jun 2013 05:22 PM PDT

Hi,I am seeing more of the following buffer latch issues these days in my error log and quite dont understand whats the issue with? Please advice.Environment:Windows 2003 SP2SQL Server 2008 SP3Disk Space : SANRAM: 128 GigsCPU: 24A time-out occurred while waiting for buffer latch -- type 4, bp 0000001710FF4280, page 1:11062976, stat 0x16c0040d, database id: 10, allocation unit Id: 72057594185187328, task 0x000000001F209708 : 0, waittime 300, flags 0x1a, owning task 0x000000001F209708. Not continuing to wait.A time-out occurred while waiting for buffer latch -- type 2, bp 0000001E19FEE380, page 1:7611136, stat 0x6c0040d, database id: 7, allocation unit Id: 72057594430291968, task 0x000000000C208748 : 0, waittime 300, flags 0x1a, owning task 0x000000000C208748. Not continuing to wait.Timeout occurred while waiting for latch: class 'LOG_MANAGER', id 000000002C3A09F8, type 4, Task 0x000000000C4E7B88 : 0, waittime 300, flags 0x1a, owning task 0x0000000006031DC8. Continuing to wait.SQL Server has encountered 1 occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [E:\MSSQL10.RISKWAREHOUSE\MSSQL\Data\MarketRisk_Prelive_1.LDF] in database [MarketRisk_Prelive] (7). The OS file handle is 0x0000000000000BD4. The offset of the latest long I/O is: 0x000001d825a800

No comments:

Post a Comment

Search This Blog