SQLCMD Does Not Work From Commandline

Jan 26, 2006

SQLCMD works in the Studio if SQLCMD Mode option is chosen.



OSQL and SQLCMD does not work from commandline and produces this constant burnt in message.

Sqlcmd:Error:Microsoft SQL Native Client:Login timeout expired.



Cleint and Server have the same set of protocols

Studio has been added to the list of those permitted by Firewall

Tried to connect through tcp, lpc

Remote has been enabled.

SQLNativeClient does not have a property or method by name 'timeout'.

Let me know if something else is needed?

View 3 Replies


ADVERTISEMENT

Unable To Get SQLCMD Utility To Work Properly.

Nov 27, 2006

I try to go to a command prompt to get this to run right with no luck. Is there something that I am not doing right? It gives me the help library, but thats about it. Also, I have dealt with Oracle in the past. And was wondering is there a way to access the SQLCMD utility on a workstation with a login of some kind?

--David

View 1 Replies View Related

Commandline Utility

Feb 25, 2008



Hi Friedns

How can i wil go command line Utility in SSIS Packages any command is there plz help me

View 6 Replies View Related

How To Run Sql Scripts From Commandline In MSDE

Jul 30, 2004

Hi,
I am trying to run sql scripts from Commandline, i am getting the error "the database doesnot exist use sp_helpdb to show available databases".
I am running this sql query to create database table, appreciate your help.
Thanks

View 1 Replies View Related

Installing SQL Express Via Commandline

Apr 1, 2007

So, I read this thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=416220&SiteID=1, which suggested that I could call SQLEXPR32.EXE (the SP2 download) with the relevant commandline args in exactly the same way I could call setup.exe. Namely, if I were to call:




Code Snippetsetup.exe /qb /settings "c:/setup.ini"



then I should be able to use




Code SnippetSQLEXPR32.exe /qb /settings "c:/setup.ini"



where my setup.ini contains




Code Snippet[Options]
ADDLOCAL=SQL_Data_Files,SQL_Replication,Connectivity
INSTANCENAME=AuctionI
SAPWD=auctioni_000
SECURITYMODE=SQL



However, this doesn't seem to be working at all - the commandline params to SQLEXPR32.EXE are completely ignored, and it runs as if they were not specified.



Would be great to get some help on this. I'm equally happy with the set of commands I need to call in order to extract SQLEXPR32 and then run setup, but SQLEXPR32 seems to extract to a random GUID dir, and automatically start setup, neither of which is condusive to automating it.



Thanks,

Dan

View 6 Replies View Related

Osql And CommandLine Stored Procedures

Feb 8, 2005

I'm currently developing a number of SQL scripts to handle a major upgrade of our database from a development server to a production server using Osql.

Everything is working fine, but I have each of the scripts generating text-output and am hoping someone may know how to suppress some the Caution text (specifically triggered when a column has been renamed).

Can anyone provide a possible solution? (there's so many notes being written to the console its easy to miss the errors I'm concerned about.

Thanks!

Ted

View 1 Replies View Related

SQL Express Advanced Commandline Install

Jun 8, 2006

I'm trying to install SQL Express Advanced Services from the commandline, but cannot get Management tools to install.

Does anyone know the correct commandline to get this to work?

thanks,

Daren

View 6 Replies View Related

SQL JOB: CommandLine PASSWORD To Run SSIS Package

Jun 15, 2007

stupid question time...



how do i add a password (ie, what is the exact wording) to the CommandLine in a SQL Agent Job that is running an SSIS package from the File System, pls?



Here is the CommandLine as I currently have it:



/FILE "\dbase01c$SSISPackageDeployment vrscanus_process_uploadscanus_process_upload.dtsx" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING E



I have tried /PWD and /pwd and /PASSWORD already. For these, SQL Job says they are not valid commandLine parameters.



thanks/spirits,



seth j hersh

View 3 Replies View Related

Creating Maintenance Plans Via The CommandLine.

Feb 5, 2007

Hello All,

I've searched high and low for documentation on this to no avail.

Basically my goal is to create a maintenance plan in SQLSERVER2005 via the command line. I need to create this plan in a way that it can be seen in the list of Maintenance Plans in the Management Studio Interface. I went into the SSIS designer and created my plan. I now have a DTSX file. I tried the dtutil.exe utility, however i never saw my maintenance plan in the list of plans.

I ran dtutil.exe and did /FILE to /SQL but i don't see the plan listed or in a way a user could modify it, which is of the utmost importance to my clients.

How do i get my file to turn into a real running Maintenance Plan that is seen in the list of Maintenance Plans via the Management Studio Interface and is editable by clients?

Other things to keep in mind, i'm attempting to create these via Installshield MSI installer. So i need to do it via command line, or file system-wise. No interface or user interaction.

Please Advise.

View 1 Replies View Related

Question About Commandline /Reporting Option

May 12, 2008



Hi,
In the BOL article on dtexec it states in the section on the /Reporting option:


The optional parameter event_guid_or_name is a list of exceptions to the log providers

What is an event GUID?

Thanks
jamie
[Microsoft follow-up]

View 7 Replies View Related

Attaching A .mdf File To The MSSQL 2000 Using Commandline

Mar 30, 2007

Hi ,

we have a requirement to create a database of our application in client's system. and we assume that already MS Sql server is installed.

we have a .mdf file of our database. Is there any way I can attach .mdf file to the database using command line. so that I can write a batch file and run that batch to create the database in our client's system.

-regards

GRK

View 4 Replies View Related

Analysis :: How To Create CommandLine Action Using ASSL

Oct 7, 2015

I want to create a commandline action. It is my understanding that commandline actions can only be created using ASSL. I cannot find the details required to build the xmla. My ultimate goal is to be able to open a file from a unc path via a cube action.

Using a URL action will not work since the path does not start with http or https.  Prepending 'file:' to the unc, with however many hashes you like, does not work with the URL action either. I am hoping I can pass the unc to the commandline and render the file.  In any case, it looks like the information needed to create a commandline action is not currently available. 

View 5 Replies View Related

What Procedures Need To Be Done On A SQl Sever 2005 Database Before Commandline Backups Can Be Successfull

Jun 12, 2007

I have a sql sever 2005 express edition database but when i run my backup command from the command prompt, i get this error message .
The .Net SqlClient Data Provider has received a severity 16, state 11 error number 911 on line 1 of procedure on server KSS15SQLEXPRESS: Could not locate entry in sysdatabases for database 'DATABASE1'. No entry found with that name. Make sure that the name is entered correctly. The .Net SqlClient Data Provider has received a severity 16, state 1 error number 3013 on line 1 of procedure on server KSS15SQLEXPRESS: BACKUP DATABASE is terminating abnormally.
DATABASE one is the name of the database i want to backup. Now it looks there so many databases some of which i have no idea where they are. It looks like there some system stored procedures i have to run first before my database file can be located by my commands. It would be wonderfull if some one pointed me to an article that covers this initial part thoroughly.

View 3 Replies View Related

SQLCMD

May 4, 2007

I cannot get SQLCMD to run. When I run it, it appears for a few seconds then dissappears. I tried running it in cmd and it says it cannot run because the default setting for SQL server does not allow remote connections. Please help.

View 11 Replies View Related

SQLCMD

May 2, 2008

When connecting to SQL using the SQLCMD
Is there a way to do a select and it output in DOS mode...

Even have the message return - completed just as if you were in sql query.

View 1 Replies View Related

SQLCMD

May 22, 2008



Hello,

Does anyone know how to execute a stored procedure in a SQLCMD script? Here is what I have so far and it doesn't seem to be working...

:r $(rootPath)"Script.sql"
GO
exec sp_Proc
GO


Also,

Is there a way that I can pass the $(rootpath) as a parameter in my stored proc?

Thanks!

View 3 Replies View Related

SQLCMD.exe

Feb 21, 2008



I am trying to backup/restore a sql db using sqlcmd. My question is, the box that I am trying to run sqlcmd on does not have SQL server 2005 installed, can I just copy SQLCMD.exe to the box instead of Installing it? if so, are there any other files that I need to copy as well?

I have another instance where I was trying to backup/restore a 2000 sql db and all I did was copy the osql.exe and resource files to the box and was able to run this command with out installing SQL server 2000. So, did something change with SQL serve 2005?

Thanks for any suggestions

View 6 Replies View Related

Need Example -- SQLCMD -y

Aug 23, 2006

Hi,

Please can any one let me know jhow to use -y option with SQLCMD.







View 11 Replies View Related

Sqlcmd Syntax

Jul 20, 2007

How can I use sqlcmd to execute a simple stored procedure, I dont need to pass parameters in or out, its just for backups.

Thanks

View 2 Replies View Related

Sqlcmd Question

Mar 3, 2008

Greetings all!

i am using the follownig sqlcmd command to output some data :

sqlcmd -E -S myServermyInstance -s "," -W -d myDB -Q " set nocount on select ltrim('""' + cast(PersonId as varchar) +
'-' + cast(DatabaseId as varchar) + '""') as 'URN-DBID','""' + EmailAddress + '""' as EmailAddress from myDB.dbo.myTable where
DTS > dateadd(dd, -7, getdate()) set nocount off " > "\tfsvrCompanyDatabase DevelopmentTestReports"myRecords-20080303.txt

The output looks something like this :

URN-DBID,EmailAddress
--------,------------
"5-1","blahblah@HOTMAIL.COM"
"264541-1","blahblah@HOTMAIL.COM"
"1107457-1","blahblah@HOTMAIL.COM"
"6133752-1","blahblah@HOTMAIL.COM"

Is it possible to keep the headnigs but remove the dashed line?

Your help would be much appreciated.

View 5 Replies View Related

Sqlcmd Question

Mar 3, 2008

Greetings all!

i am using the follownig sqlcmd command to output some data :


sqlcmd -E -S myServermyInstance -s "," -W -d myDB -Q " set nocount on select ltrim('""' + cast(PersonId as varchar) +
'-' + cast(DatabaseId as varchar) + '""') as 'URN-DBID','""' + EmailAddress + '""' as EmailAddress from myDB.dbo.myTable where
DTS > dateadd(dd, -7, getdate()) set nocount off " > "\mynetworkdrivemyCompanymyDatabase DevelopmentmyTestReports"myRecords-20080303.txt


The output looks something like this :

URN-DBID,EmailAddress
--------,------------
"5-1","blahblah@HOTMAIL.COM"
"264541-1","blahblah@HOTMAIL.COM"
"1107457-1","blahblah@HOTMAIL.COM"
"6133752-1","blahblah@HOTMAIL.COM"

Is it possible to keep the headnigs but remove the dashed line?


Your help would be much appreciated.

View 4 Replies View Related

Sqlcmd - View

Mar 21, 2006

how can i change the view in sqlcmd?

such as changing the font or the window size so that a command such as sp_tables will list on one row rather than several. Also I would only like to see 10 records or so at the same time. Currently in default setting, if i run sp_tables I can really only view the last few records.

thanks!

View 1 Replies View Related

What Is The Alternative To Go Under Sqlcmd?

Oct 8, 2006

Hi

I found it a bit annoying to type Go after some very simple query and I wonder is there a short cut to execute the query i type right after I press enter?

1> select * from Table
2> go <enter>

instead, how to you execute line 1 without entering go?

Thank you

View 7 Replies View Related

Backups From SQLcmd ??

Nov 9, 2006

I am working with SQL Express and found myself surprised when I tried to automate a backup... No Agent.

So I am trying to create a simple backup script to run from the command line and probably schedule through the scheduled task manager.

here is my problem. I get the following error :

Msg 2812, Level 16, State 62, Server FIREFLYSQLEXPRESS, Line 1
Could not find stored procedure 'B'.

Here is the batch file

sqlcmd -i c: emp estDBbackup.sql -o c: emp estoutput.txt -S FIREFLYSQLEXPRESS

And here is the sql input file :

BACKUP DATABASE [DNNDEV] TO DISK = 'C: emp estdnndev.bak' WITH NOFORMAT, NOINIT, NAME = 'dnndev-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10;

If I put a USE statement in front of my backup statement - the error message changes to

Could not find stored procedure 'U'.

So it would appear to list the first character encountered.

As a sanity check I created a similar process which does a select * from a table and I do not get an error saying :Could not find stored procedure 'S'. - instead all is well and I get my output and no error

If I try the backup command in SQLCMD interactively it works.

so what the heck am I missing ?

Thank you for any help...

View 4 Replies View Related

SQLCMD Error

Apr 14, 2008

Dear profetionlas:
I cannot run sqlcmd in my computer but i can connect to my SQL Server2005 through SSIS
This is the error I see .
Please give me some recommandation


C:Documents and Settings est>sqlcmd
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establi
shing a connection to the server. When connecting to SQL Server 2005, this failu
re may be caused by the fact that under the default settings SQL Server does not
allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.


I would like also metion that
1)windows firewall is off
2)All SQL server Services are running
3)This is my default instance also I have another named instance in the server

View 4 Replies View Related

Sqlcmd Not Recognized

Oct 9, 2006

Just installed SQL Server 2005 Express along with the Management Studio. The Management Studio, at least what I've seen so far, seems to work fine. But when I type "sqlcmd" at the command prompt, I get "sqlcmd is not a recognized internal or external command, operable program or batch file." What gives???

View 4 Replies View Related

SQLCMD Wont Start

Mar 1, 2008

 GreetingsI'm trying to follow the tutorial at http://www.asp.net/Guided%2DTour/s2.aspx  Part way through the demo it asks me to run the following command as part of building  a Demo web page access SQL  dataC:Program FilesMicrosoft SQL Server90ToolsinnSQLCMD"
-S "machine-nameSqlExpress"  I am then supposed to  paste  some script into  that window, but cant  get  that  far. The black Command window opens, but the SQL > prompt doesn't appear, and  the  window closes. I had previously installed a demo version of Web  Developer Express from my Action  Pack,  on a SBS Server  Premium 2003 R2, clean installation. When I got to the  above step  in the  demo there was no ...90Toolsinn folder so, I uninstalled the  Action  Pack version and the versions of  SQL server that  looked like they  did not belong to the  original  SBS Server installation.  I then downloaded the version from Microsofts website, and selected .Net SP1 and SQL Server  Express ( or lite or whatever it's called )  that were part of the  install dialog box. When checking  for  updates, the .NET  SP1 and  Visual Studio SP1 initial  failed. Rebooting  installed  .Net  SP1, but  I had  to do  a hard reboot as the  installation still wasn't  complete after 2 hours. I  assumed it was hung. After  restarting, I was  able  to go to  MSUpdates and  the  installation was successful.Currently the add remove programs shows  a ton of  SQL stuff, ..I'm guessing we  have  version conflicts or something  but I don't know.. Microsoft  SQL Server 2005Microsoft SQL Server Desktop engine  "                             Native Client  "                             Setup Support files  "                             VSS Writer Visual  Studio  seems to  run okay, but I  would  like to  be able to do SQL  database  part of the  tutorial, since I  don't know  much  about it as you can tell, and I would like to see it work with web sites. TimeTraveller    

View 1 Replies View Related

Fail To Connect Using Sqlcmd

May 15, 2008

Hi !
I try to connect to a database on my localhost using sqlcmd. For the records: Remote connections are allowed ! I don't have any issues to establish a connection using SSMS.

S:DBWorkFolder>sqlcmd -U razorblade -P xxxxx -S localhostzen_dev4

This is what I get:

HResult 0xFFFFFFFF, Level 16, State 1
SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

Any help appreciated !

Thanks: Peter

View 1 Replies View Related

Sqlcmd And Escape Characters

Nov 22, 2007

The command below runs fine from within Management Studioexec sp_MSforeachtable @command1="exec sp_spaceused '?' "However, I'd like to run it via sqlcmd. I've tried variouscombinations of escaping the doulbe and single quotes but withoutsuccess.sqlcmd -E -Q "sp_MSforeachtable @command1="exec sp_spaceused '?'""Sqlcmd: 'exec sp_spaceused '?'""': Unexpected argument. Enter '-?'for help.Any ideas?Thanks,M

View 2 Replies View Related

Problem In Mirroring When Using SQLCMD

May 4, 2007

Dear all,

I'm having a problem with configure Mirroring. When I use graphical inteface to config the Mirror, it is ok. But when using sql, there are an error that I can not understand.

Here is the code:

ETVAR PrincipalServer DEMOPARTNERA
ETVAR MirrorServer DEMOPARTNERB
ETVAR WitnessServer DEMOWITNESS
ETVAR Database2Mirror AdventureWorksDW
go

N ERROR EXIT
go

:CONNECT $(PrincipalServer)

-- Mirroring ONLY supports the FULL Recovery Model
ALTER DATABASE $(Database2Mirror)
SET RECOVERY FULL
go

USE $(Database2Mirror)
go

CREATE ENDPOINT Mirroring
STATE=STARTED
AS TCP (LISTENER_PORT=5022)
FOR DATABASE_MIRRORING (ROLE=PARTNER)
GO

:CONNECT $(MirrorServer)

CREATE ENDPOINT Mirroring
STATE=STARTED
AS TCP (LISTENER_PORT=5023)
FOR DATABASE_MIRRORING (ROLE=PARTNER)
GO

:CONNECT $(WitnessServer)

CREATE ENDPOINT Mirroring
STATE=STARTED
AS TCP (LISTENER_PORT=5024)
FOR DATABASE_MIRRORING (ROLE=WITNESS)
GO

:CONNECT $(PrincipalServer)

BACKUP DATABASE $(Database2Mirror)
TO DISK = 'C:TechReady$(Database2Mirror).bak'
WITH INIT
GO

:CONNECT $(MirrorServer)

DECLARE @InstanceName sql_variant,
@InstanceDir sql_variant,
@SQLDataRoot nvarchar(512),
@ExecStr nvarchar(max)

SELECT @InstanceName = ISNULL(SERVERPROPERTY('InstanceName'), 'MSSQLServer')

EXECUTE master.dbo.xp_regread 'HKEY_LOCAL_MACHINE',
'SOFTWAREMicrosoftMicrosoft SQL ServerInstance NamesSQL',
@InstanceName, @InstanceDir OUTPUT

SELECT @ExecStr = 'EXECUTE master.dbo.xp_regread '
+ '''HKEY_LOCAL_MACHINE'', '
+ '''SOFTWAREMicrosoftMicrosoft SQL Server'
+ convert(varchar, @InstanceDir)
+ 'Setup'', ''SQLDataRoot'', @SQLDataRoot OUTPUT'

EXEC master.dbo.sp_executesql @ExecStr
, N'@SQLDataRoot nvarchar(512) OUTPUT'
, @SQLDataRoot OUTPUT

IF @SQLDataRoot IS NULL
BEGIN
RAISERROR ('Did not find the correct SQL Data Root Directory. Cannot proceed. Databases backed up but not yet restored.', 16, -1)
END

CREATE TABLE #BackupFileList
( LogicalName sysname NULL
, PhysicalName sysname NULL
, [Type] char(1)
, FileGroupName sysname NULL
, Size bigint
, MaxSize bigint
, FileId smallint
, CreateLSN numeric(25,0)
, DropLSN numeric(25,0)
, UniqueId uniqueidentifier
, ReadOnlyLSN numeric(25,0)
, ReadWriteLSN numeric(25,0)
, BackupSizeInBytes bigint
, SourceBlockSize bigint
, FileGroupId smallint
, LogGroupGUID uniqueidentifier
, DifferentialBaseLSN numeric(25,0)
, DifferentialBaseGUID uniqueidentifier
, IsReadOnly bit
, IsPresent bit
)

INSERT #BackupFileList
EXEC('LOAD FILELISTONLY FROM DISK = ''C:TechReady$(Database2Mirror).bak''')

UPDATE #BackupFileList
SET PhysicalName
= @SQLDataRoot
+ N'Data'
+ REVERSE(SUBSTRING(REVERSE(PhysicalName)
, 1, PATINDEX('%\%', REVERSE(PhysicalName)) -1))

DECLARE @LogicalName sysname
, @PhysicalName sysname

DECLARE FileListCursor CURSOR FAST_FORWARD FOR
SELECT LogicalName, PhysicalName
FROM #BackupFileList

OPEN FileListCursor

FETCH NEXT FROM FileListCursor INTO @LogicalName, @PhysicalName

SELECT @ExecStr = N'RESTORE DATABASE $(Database2Mirror)' +
N' FROM DISK = ''c:TechReady$(Database2Mirror).bak''' +
N' WITH MOVE ''' + @LogicalName + N''' TO ''' + @PhysicalName + N''''

FETCH NEXT FROM FileListCursor INTO @LogicalName, @PhysicalName

WHILE @@FETCH_STATUS <> -1
BEGIN
SELECT @ExecStr = @ExecStr + N', MOVE ''' + @LogicalName
+ ''' TO ''' + @PhysicalName + ''''
FETCH NEXT FROM FileListCursor INTO @LogicalName, @PhysicalName
END

-- NORECOVERY is required for Database Mirroring, replace is not.
-- Replace is used here solely to allow repetitive use of this script.
SELECT @ExecStr = @ExecStr + N' , NORECOVERY, REPLACE'

-- Useful for testing
-- Only return the string and then comment out the EXEC line below.
-- SELECT @ExecStr

EXEC (@ExecStr)

DEALLOCATE FileListCursor
GO

:CONNECT $(PrincipalServer)
SELECT DATABASEPROPERTYEX(N'$(Database2Mirror)', N'Status') -- Returns ONLINE
SELECT db_name(sd.[database_id]) AS [Database Name],
sd.mirroring_guid,
sd.mirroring_state,
sd.mirroring_state_desc,
sd.mirroring_partner_name,
sd.mirroring_witness_name,
sd.mirroring_witness_state,
sd.mirroring_witness_state_desc,
sd.mirroring_role,
sd.mirroring_role_desc,
sd.mirroring_role_sequence,
sd.mirroring_safety_level,
sd.mirroring_safety_level_desc,
sd.mirroring_safety_sequence,
sd.mirroring_failover_lsn
FROM sys.database_mirroring AS sd
WHERE sd.[database_id] = db_id(N'$(Database2Mirror)')
go

:CONNECT $(MirrorServer)
SELECT DATABASEPROPERTYEX(N'$(Database2Mirror)', N'Status') -- Returns RESTORING
SELECT db_name(sd.[database_id]) AS [Database Name],
sd.mirroring_guid,
sd.mirroring_state,
sd.mirroring_state_desc,
sd.mirroring_partner_name,
sd.mirroring_witness_name,
sd.mirroring_witness_state,
sd.mirroring_witness_state_desc,
sd.mirroring_role,
sd.mirroring_role_desc,
sd.mirroring_role_sequence,
sd.mirroring_safety_level,
sd.mirroring_safety_level_desc,
sd.mirroring_safety_sequence,
sd.mirroring_failover_lsn
FROM sys.database_mirroring AS sd
WHERE sd.[database_id] = db_id(N'$(Database2Mirror)')
go

:CONNECT $(MirrorServer)

ALTER DATABASE $(Database2Mirror)
SET PARTNER = 'TCP://DEMO:5023'
-- SET PARTNER = 'TCP://Server.fully.qualified.dns.name:5091'
-- SET PARTNER = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5091'
GO

:CONNECT $(PrincipalServer)

ALTER DATABASE $(Database2Mirror)
SET PARTNER = 'TCP://DEMO:5022'
-- SET PARTNER = 'TCP://Server.fully.qualified.dns.name:5092'
-- SET PARTNER = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5092'
GO

ALTER DATABASE $(Database2Mirror)
SET WITNESS = 'TCP://DEMO:5024'
-- SET WITNESS = 'TCP://Server.fully.qualified.dns.name:5090'
-- SET WITNESS = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5090'
GO

SELECT db_name(sd.[database_id]) AS [Database Name],
sd.mirroring_guid,
sd.mirroring_state,
sd.mirroring_state_desc,
sd.mirroring_partner_name,
sd.mirroring_witness_name,
sd.mirroring_witness_state,
sd.mirroring_witness_state_desc,
sd.mirroring_role,
sd.mirroring_role_desc,
sd.mirroring_role_sequence,
sd.mirroring_safety_level,
sd.mirroring_safety_level_desc,
sd.mirroring_safety_sequence,
sd.mirroring_failover_lsn
FROM sys.database_mirroring AS sd
WHERE sd.[database_id] = db_id(N'$(Database2Mirror)')

and the log is:

Msg 1452, Level 16, State 6, Line 3
The partner server instance name must be distinct from the server instance that manages the database. The ALTER DATABASE SET PARTNER command failed.
** An error was encountered during execution of batch. Exiting.

I Think the error is begin at:

ALTER DATABASE $(Database2Mirror)
SET PARTNER = 'TCP://DEMO:5023'
-- SET PARTNER = 'TCP://Server.fully.qualified.dns.name:5091'
-- SET PARTNER = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5091'
GO

:CONNECT $(PrincipalServer)

ALTER DATABASE $(Database2Mirror)
SET PARTNER = 'TCP://DEMO:5022'
-- SET PARTNER = 'TCP://Server.fully.qualified.dns.name:5092'
-- SET PARTNER = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5092'
GO

ALTER DATABASE $(Database2Mirror)
SET WITNESS = 'TCP://DEMO:5024'
-- SET WITNESS = 'TCP://Server.fully.qualified.dns.name:5090'
-- SET WITNESS = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5090'
GO

but I can not find out the solution. Turn back to grafical interface, everything is done

Please help!

View 6 Replies View Related

Sqlcmd.exe Login Problem

Jun 19, 2007

I can Add a connection to the database in VisualStudio 2005 in the Solution Explorer and access the database. Connection string copied from VS "Data Source=.SQLEXPRESS;AttachDbFilename=C:TempMyDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True".



If i start the command prompt and type:

sqlcmd -SlocalhostSQLEXPRESS -E -d c: empMyDB.mdf



I get the error "Login failed for user 'MyDomainPer'"



As I see it integrated authentication with the same user is used in both cases so they should give the same result. What am I doing wrong?

View 3 Replies View Related

How To Do A Sqlcmd Inline Commands

May 24, 2008



hi,

i am not sure if this forum is right place to ask this question..
i am trying right a dos batch file to do setup of sql commands run by sqlcmd , run some dos commands etc

net start mssql$server
sqlcmd -E .....


net stop mssql$server...

sqlcmd -E ....


in unix you can run isql with the sql commands place inside..


isql -Uuser -S server <<EOF
select 1
select 2
go
EOF


you can put above in a shell and it will run.

i am trying to do similar stuff in windows for sqlcmd.. how can i do it

only option i have is to create lot of .sql files and
run with -i option on sqlcmd..


can some body let me know how to do a inline commands in dos?
thx
AK

View 1 Replies View Related

Sqlcmd - Empty Serverlist

Dec 18, 2006

At the end of my rope here ... I was using SQL Express 2005 without trouble, until one day I couldn't access my database. I spent a day hunting down the issue without success. I uninstalled and reinstalled SQL Server many times, each time hoping it would somehow help ...

I can access SQL Server just fine through SQL Server Management Studio Express. I can get in by typing "sqlcmd -S {my machine name}SQLEXPRESS". However, I am working on a FoxPro application, and I cannot connect using FoxPro. It doesn't even seem to recognize the existence of SQL Server on the machine. Also, when I log in using sqlcmd, and type ":serverlist", I would expect my SQLEXPRESS instance to show up. It doesn't - the list of servers is empty. I suspect this is the problem, but have no idea what may be causing it.

Cumulatively, I've probably spent 3 work days trying to figure this out. Does anyone have any pointers or ideas that might help me figure out why ":serverlist" doesn't list my machineSQLEXPRESS, even though I can log in fine using Management Studio? Any help would be very much appreciated. Thank you,

matt

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved