Posted on

auto-generate INSERT statements for a SQL Server table

  1. Right-click on the database and go to Tasks > Generate Scripts.
  2. Select the tables that you want to generate the script.
  3. Go to Set scripting options tab and click on the Advanced button.
  4. In the General category, go to Type of data to script
  5. There are 3 options: Schema OnlyData Only, and Schema and Data. Select the appropriate option and click on OK.

Posted on

SQLSERVER – Backup on mapped drive

Scenario

You are trying to backup a sqlserver db on mapped network drive. You have already mapped the drive in Windows and you can see that drive in Windows Explorer. You are not able to see the drive which is mapped when you open the backup procedure using SqlServer Managment studio.

Solution

First of all you not need the previous mapped network drive created by Explorer. You have to create this drive using SqlServer, and you’ll not be able to see it using Exploer.

Enable xp_cmdshell

You need to execute below to enable xp_cmdshell as its disabled by default due to security reasons. (Please turn off again once you done with the work)

Using SSMS execute thesse commands :

EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'xp_cmdshell',1
GO
RECONFIGURE
GO

After this you ‘ll have a positive reaction a this command that using SSMS you should use for testing previous operations :

EXEC XP_CMDSHELL 'Dir C:'

Map Network Drive

To map network drive you have to use the same command that you should use over Windows ysig command prompt :

'net use Z: \\networkShare\Test'

So, using SSMS you have to run the command

EXEC XP_CMDSHELL 'net use Z: \\networkShare\Test'

Now you should test this connection with the command

EXEC XP_CMDSHELL 'Dir Z:'

but, the most important goal, is tha you’ll be able to see teh drive Z during backup proceure over SSMS

Map Network Drive cmd – net use user password

The above command will work and completes successfully without asking the user to provide a username/password if the user has authorized access to this network share. If not, But the easy way is to use the “net use” command on the command prompt line explained above.

net use Z: \\networkShare\Test /u:domainname\username password

So, using SSMS you have to run the command

EXEC XP_CMDSHELL 'net use Z: \\networkShare\Test /u:domainname\username password'
Posted on

prerequisites to install veeam backup and replication

To install Veem Backup and Replication on Windows 2012 server, you need :

  1. Sql server 2014 Exprees
  2. Net Framework 3.5 (install it directly from your windows server). Necessary for Sql server Managment Studio 2014
  3. Sql server managment studio 2014
  4. From Microsoft® SQL Server® 2014 Feature Pack (https://www.microsoft.com/en-us/download/details.aspx?id=42295), you have to download and install
    1. SQLSysClrTypes.msi
    2. SharedManagementObjects.msi
  5. MICROSOFT® REPORT VIEWER 2015 RUNTIME
  6. Windows 10 Universal C Runtime

 

Posted on

installing sqlserver 2008: Performance counter registry hive consistency check failed

if, during installation of Sql Server 2008 you have this error : Performance counter registry hive consistency check failed

First try

Open a command prompt with administrator user rights (Run as Administrator)

cd c;/windows/system32
lodctr /R:PerfStringBackup.INI

Restart the system and try again to install sqlserver

Second attempt

Open a command prompt with administrator user rights (Run as Administrator). Lunch install without that feature

C:\MyFolder\SQLEXPR_x86.exe /ACTION=install /SKIPRULES=PerfMonCounterNotCorruptedCheck
Posted on Leave a comment

Sql Server 2014, Integration Services and Oracle

SSIS and SSDT on SQL SERVER 2014

SSIS is not present on Sql Server 2014. To create Integration Service packages, you must download and install SQL Server Data Tools (SSDT).

Download SSDT

You will also use this tool to convert SSIS packages created with Sql Server 2008 into the new project format.

Connect to Oracle from SSDT on SQL SERVER 2014

To connect to Oracle through ADO.NET in the SSDT environment, you must install an Oracle client. You’re definitely working on a 64-bit machine. You must download the 32-bit client and install it by choosing the “Administrative” installation type.