Error when using sqlmaint.exe with SQL Server 2008 R2 Express - sql

Before my migration from MSDE (SQL Server 2000) to SQL Server 2008 R2 Express, I used the following sentence to take a backup of my database :
C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn>sqlmaint.exe
-S \"(local)\\SQLEXPRESS"\
-D \"DB Name"\
-BkUpDB \#"C:\Documents and Settings\emmug\Application Data\CalibrationSystem\Backup"\
-BkUpMedia DISK
But now, I get this error :
Microsoft (R) SQLMaint Utility (Unicode), Version 10.0.1600.22
Copyright (c) Microsoft Corporation.
The SQLDMO 'Application' object failed to initialize (specific error: One of the library files needed to run this application cannot be found.)
So I saw that SQLDMO was not supported in SQL Server 2008 R2 but I could use Microsoft SQL Server 2005 Backward Compatibility Components. Unfortunately, that doesn't work.
Microsoft now uses SQL Server Management Objects (SMO) but there don't give any code sample to help me.
So is there somebody know a solution for my issue ?
Thanks
Emmanuel

You can use SQLCMD.exe, e.g
SQLCMD.exe -S "(local)\SQLEXPRESS" -Q"BACKUP DATABASE dbName TO DISK = 'C:\Documents and Settings\emmug\Application Data\CalibrationSystem\Backup\dbname.bak'"

Related

Could not load package from "...\sql\debug\database.bacpac"

I have built my database project for SQL Server 2012. And I am using following command to prepare deployment script,
"C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\SqlPackage.exe" /Action:Script /TargetDatabaseName:DacPacTest1 /TargetServerName:"demo2012util" /SourceFile:"C:\some\path\DBProject\Database\sql\debug\Database.dacpac" /op:"C:\some\path\DBProject\test2.sql"
I am getting this error
*** Could not load package from 'C:\some\path\DBProject\Database\sql\debug\Database.dacpac'. Could
not find a part of the path
'C:\some\path\DBProject\Database\sql\debug\Database.dacpac'.
It appears that I might have wrong database target and this error is because of that, but I have verified that I have built project using SQL Server 2012 as target and SQLPackage.exe is also same SQL Server version (110).
Any suggestions?

Restore BacPac database backup in sql server 2014

I have database backup file with extension .bacpac so how can i restore it in sql server 2014 ?
Two options:
In SQL Server Management Studio, right-click on the Databases folder in the Object Explorer tree. Then click on "Import Data-tier application". The wizard will guide you through the process.
From the command line, run this command: "c:\program files (x86)\Microsoft sql server\120\dac\bin\sqlpackage.exe" /a:import /sf:"PATH_TO_YOUR_BACPAC_FILE" /tcs:"Data Source=YOUR_SERVER_NAME;Initial Catalog=NEW_DATABASE_NAME;Integrated Security=true"
Aside: Note that the example connection string in the command line option above assumes you're using Windows Authentication instead of SQL Server authentication to access the server.

How to execute a DTSX package from windows 2000 server

I am trying to execute a DTS package using DTSEXEC command from windows 2000 server.
I end up getting the error " DTSEXEC is not recognized as internal or external command"
Is there any way to achieve this task?
DTEXEC.EXE is for SSIS (SQL Server > 2000). Instead, try DTSRUN.exe for DTS (SQL Server 2000).

SqlPubWiz Command Line: Error: Operation is not valid du e to the current state of the object

I'm trying to script a db from the command line as part of a powershell script. If i run the gui it works.. if I run the same type of operation from the command line it fails:
"C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Publishing\1.4\SqlPubWiz" script -d DBNAME DBNAME.sql -schemaonly -targetserver 2008
for some reason I'm getting the following output and I have no idea how to fix!
Generating script for database DBNAME
- Generating only metadata script
- Generating script targeted for SQL Server 2008
Gathering list of objects to script
Scripting objects
................................................Error: Operation is not valid due to the current state of the object.
Microsoft (R) SQL Server Database Publishing Wizard
Version 10.0.0.0
Copyright (c) Microsoft Corporation. All rights reserved.
Maybe it's what I had: it appears that DBNAME is case sensitive.
Found on:
http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/ecfd4379-ee88-4a60-81a4-d6cc9542b1ff
Hope this helps someone

SQL Server 2008 installed, though running version is still 2005

A while back I installed SQL Server 2008 on a development machine which already had Sql Server 2005 express from Visual Studio. When I look in my programs, I see 'Microsoft Sql Server 2008', which contains the management studio, etc. As well I can see 'MS Sql Server 2005'.
When I run a query in Management Studio 2008 to select the version running on my machine, it comes up as 2005, and leaves me scratching my head. When I look in the configuration manager, all I see is the SQLEXPRESS instance running ...
Are there any "quick" solutions to get 2008 running instead of 2005, considering 2008 is installed?
If your using the SQL Server 2005 Configuration Manager you will only see 2005 instances and lower.
To view instances of SQL Server 2008 you will want to make sure you are using SQL Sever 2008 Configuration Manager.
The final option would be to View All services using the Service Control Manager. Here you will need to look at what instances of SQL Server you have running on the machine.
If you want to find all the instance names, one way is to run powershell and execute the following
PS C:\> gwmi win32_service -filter "name like 'MSSQL%'" | fl DisplayName, pathname
For me the result is
DisplayName : SQL Server (SQLEXPRESS)
pathname : "c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\B
inn\sqlservr.exe" -sSQLEXPRESS
DisplayName : SQL Server (SQLEXPRESS2005)
pathname : "c:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Binn\sqlserv
r.exe" -sSQLEXPRESS2005
DisplayName : SQL Full-text Filter Daemon Launcher (MSSQLSERVER)
pathname : "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\
Binn\fdlauncher.exe" -s MSSQL10.MSSQLSERVER
DisplayName : SQL Server (MSSQLSERVER)
pathname : "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\
Binn\sqlservr.exe" -sMSSQLSERVER
DisplayName : SQL Server Active Directory Helper
pathname : "c:\Program Files\Microsoft SQL Server\90\Shared\sqladhlp90.exe"
DisplayName : SQL Active Directory Helper Service
pathname : "C:\Program Files\Microsoft SQL Server\100\Shared\SQLADHLP.EXE"
DisplayName : SQL Server Analysis Services (MSSQLSERVER)
pathname : "C:\Program Files\Microsoft SQL Server\MSAS10.MSSQLSERVER\OLAP\bi
n\msmdsrv.exe" -s "C:\Program Files\Microsoft SQL Server\MSAS10.M
SSQLSERVER\OLAP\Config"
Look for the one that has MSSQL10 and make sure that the service is started. Then use that instance name when connecting via SSMS.
If for some reason you didn't install into the default structure you can always visit the Exe directly and check its version for something like 2007.100.xxx
I happen to have 2005 and 2008 express as well as 2008 standard
If I was better at PowerShell I would have piped the PathName to get the version info