NSIS not resolving magic variables in the proper way? - sql-server

I try to install MS SQL 2008 R2 with NSIS so I use this code snippet:
SetOutPath "$TEMP\Unit\DimIns\binary\SQLSVR"
File /r "..\..\shared-binaries\download.unit.hu\MsSQLServer2008R2\SQLSVR-x86\"
SetOutPath "$TEMP\Unit\DimIns\"ExecDos::exec "$OUTDIR\binary\SQLSVR\setup.exe /QUIET /IACCEPTSQLSERVERLICENSETERMS /ConfigurationFile=$OUTDIR\binary\SQLSVR\dimsqlsetup.ini /ACTION=Install" "" "$OUTDIR\MsSQLServer2008R2.log"
But it will fail. And it output this error message:
The following error occurred:
The action type 'ExecuteWorkflowAction' is not valid for the WorkflowIdentity element. The only valid action type is ExecuteWorkflowAction.
Error result: -2068709375
Result facility code: 1202
Result error code: 1
Please review the summary.txt log for further details
The following error occurred:
The action type 'ExecuteWorkflowAction' is not valid for the WorkflowIdentity element. The only valid action type is ExecuteWorkflowAction.
Error result: -2068709375
Result facility code: 1202
Result error code: 1
Please review the summary.txt log for further details
Microsoft (R) SQL Server 2008 R2 Setup 10.50.4000.00
Copyright (c) Microsoft Corporation. All rights reserved.
But if I explicit give the path
ExecDos::exec "C:\Users\UNIT-TEST\AppData\Local\Temp\Unit\DimIns\binary\SQLSVR\setup.exe /QUIET /IACCEPTSQLSERVERLICENSETERMS /ConfigurationFile=C:\Users\UNIT-TEST\AppData\Local\Temp\Unit\DimIns\binary\SQLSVR\dimsqlsetup.ini /ACTION=Install" "" "C:\Users\UNIT-TEST\AppData\Local\Temp\Unit\DimIns\MsSQLServer2008R2.log"
or run it from the CMD
C:\Users\UNIT-TEST\AppData\Local\Temp\Unit\DimIns\binary\SQLSVR\setup.exe /QUIET /IACCEPTSQLSERVERLICENSETERMS /ConfigurationFile=C:\Users\UNIT-TEST\AppData\Local\Temp\Unit\DimIns\binary\SQLSVR\dimsqlsetup.ini /ACTION=Install
Then the installer install MS SQL correctly. So I can't imagine anyting else that the $TEMP or the $OUTDIR resolved in a bad way by NSIS. Is it possible or where is the problem?
If I write out the content of the $TEMP or the $OUTDIR to the console log its looks like they store the correct path.

I do not like the syntax of your command. Use this syntax:
nsExec::ExecToStack [OPTIONS] '"PATH" param1 param2 paramN'
to be sure all parameters and paths are treated correctly.
There is probably space in your path which is causing a trouble.

Have you tried adding extra quotes for all paths?
ExecDos::exec '"$OUTDIR\binary\SQLSVR\setup.exe" /QUIET /IACCEPTSQLSERVERLICENSETERMS /ConfigurationFile="$OUTDIR\binary\SQLSVR\dimsqlsetup.ini" /ACTION=Install' "" "$OUTDIR\MsSQLServer2008R2.log"

Related

Sqlcmd: Error: near command 'Ë'

I'm importing a 7GB .sql file and I got this error:
Sqlcmd: Error: Syntax error at line 7863597 near command 'Ë' in file 'C:\inetpub\wwwroot\project\MS_SQL_Dump\MS_SQL_Dump.sql'.
I'm currently trying running the import command again but with double quotes around the path/filename. I don't know if that will work though, it was suggested on a comment on this question.
Any idea what the issue is and how to resolve it?
It could be because you have a $ in your query. Try adding -x to the end of your sqlcmd statement, ie:
sqlcmd -i c:\import.sql -x
Worked for me...hope it helps someone!
source: https://ts.apexsql.com/the-sqlcmd-error-syntax-error-at-line-xyz-near-command-x-in-file-file_name-sql-error-is-encountered-when-running-sql-script-via-sqlcmd-utility/
all I've got is a .sql file
In this case try to load this script view dbForge for SQL Server:
and provide error message...
I've experienced this before and this error is due to quotation marks.
Please on the quoted_identifier setting which is defaulted to OFF.
Please take a look on sqlcmd options here : sqlcmd utility
When SET QUOTED_IDENTIFIER is ON, identifiers can be delimited by double quotation marks, and literals must be delimited by single quotation marks. When SET QUOTED_IDENTIFIER is OFF, identifiers cannot be quoted and must follow all Transact-SQL rules for identifiers. For more information, see Database Identifiers.
To set this to on just add sqlcmd option "-I" (take note of the case )
Like this :
sqlcmd -I

r: "$(fileName)" in a script called from sqlcmd

I'm trying to create a script just to run other scripts and do some extra stuff in case of successful or failure.
You have the full code on this link just to try to be clear what I'm trying to achieve.
Basically I want to:
-- DO SOME STUFF HERE
r: "$(fileName)"
-- MORE STUFF HERE
and call it from sqlcmd this way:
sqlcmd -i "RunScript.sql" -v fileName="someFileName.sql" -s server -d database
But I can't, I'm getting the following error:
Msg 102, Level 15, State 1, Server SERVER, Line 19 Incorrect syntax
near 'someFileName.sql'.
So, it seems that the little r: couldn't be used with a parameter on his side.
Just to clarify, someFileName.sql isn't in the SQL Server, but in my machine, so I couldn't use this way to read the file. In fact, I just tried it later.
Is there a workaround to archive this? Any ideas to solve it?
You could break your current RunScript.sql script into separate header and footer SQL scripts and concatenate them together with a SQL script in the middle that is denoted by an input parameter to a CMD script. For example:
RunSQL.CMD consists of:
#ECHO OFF
COPY /V /Y RunScriptHeader.sql + %1 + RunScriptFooter.sql RunScriptTemp.sql
SQLCMD -i "RunScriptTemp.sql" -s server -d database
The /V does a verify on the copy
The /Y suppresses prompting to confirm overwriting an existing file
You would run it as follows:
RunSQL.CMD someFileName.sql

Error in installing ctc 4

When i tried installing ctc4 on wp8, the following is displayed in cmd.
C:\Program Files (x86)\IBM\WebSphere\wp_profile>ctc-install
C:\Program Files (x86)\IBM\WebSphere\wp_profile>rem (C) Copyright IBM Corp. 2010, 2011.
C:\Program Files (x86)\IBM\WebSphere\wp_profile>rem Batch file to install CTC
"Loaded ctc.properties file"
"PAA Path resolved to C:\PROGRA~2\IBM\WEBSPH~1\WP_PRO~1\paa\ctc.paa"
passed -properties C:\PROGRA~2\IBM\WEBSPH~1\WP_PRO~1\ctc.properties
"using C:\PROGRA~2\IBM\WEBSPH~1\WP_PRO~1\ctc.properties file"
"Properties set"
"PAA Path resolved to C:\PROGRA~2\IBM\WEBSPH~1\WP_PRO~1\SITE-B~1\paa\site-builder.paa"
"Running install-paa -DPAALocation=C:\PROGRA~2\IBM\WEBSPH~1\WP_PRO~1\SITE-B~1\paa\site-builder.
paa -DappName=wp.ctc.nswiz -DofflineMode=true -Dcomponents/wp.ctc.nswiz.app=true -Dcomponents/w
p.ctc.nswiz.appcontent=true -Dcomponents/wp.ctc.nswiz.apppage.base=true -Dcomponents/wp.ctc.nsw
iz.appcontent.blank=false -Dcomponents/wp.ctc.nswiz.apppage.virtual=false -DFAILURE_LOG_DIR
=C:\PROGRA~2\IBM\WEBSPH~1\WP_PRO~1\SITE-B~1"
**'C:\Program' is not recognized as an internal or external command,**
operable program or batch file.
ctc.properties
**\IBM\WebSphere\wp_profile\paa\wp.ctc was unexpected at this time.**
I don't know how to solve this. Pls help.
One suggestion is that install Portal in a location without spaces in between(ie : C:\IBM\WebSphere\PortalServer) .Also,in your ctc.properties , enter the PROFILE_DIR path in quotes "C:\Program Files (x86)\IBM\WebSphere\wp_profile"

has anyone faced this error "Error: No valid counters" using type perf?

Has anyone faced this error, Error: No valid counters, using typeperf utility while writing it to SQL database. I have tried variety of different things but every time I try to write it in SQL database using counters in a file it fails with the No valid counters error.
The command was executed in the following fashion:
C:\>typeperf -cf "E:\DBA\CounterCollector\counters_eg.txt" -si 15 -sc 10 -f SQL -o SQL:SQLServerDS!log5
The counters_eg.txt file contains:
"\\<computername>\PhysicalDisk(* *)\Avg. Disk Queue Length"
I am able to write in SQL database by specifying the counters individually at command prompt.
example:
C:\Windows\system32>typeperf -f SQL -o SQL:SQLServerDS!log4 "\\<computername>\PhysicalDisk(* *)\Avg. Disk Queue Length"
Note: I have replaced the server name by <computername>.
Include a double '%%', i.e.
typeperf "\\<remote-IP>\Process(*)\%% Processor Time" -sc 1
Figured it out:
After following the example from
https://www.simple-talk.com/sql/performance/collecting-performance-data-into-a-sql-server-table/
I kept on getting the same error message "Error: No valid counters". The counter.txt is exactly the same like the example provided by Feodor but when I put the counter names on the command line individually, they get processed successfully. The problem I was getting was when I tried to run the entire syntax.
Instead of using what Feodor used:
"TYPEPERF -f SQL -s ALF -cf “C:\CounterCollect\Counters.txt” -si 15 -o SQL:SQLServerDS!log1 -sc 4",
I tweaked it a little bit (after looking at the second example from http://technet.microsoft.com/en-us/library/cc753182.aspx) and finally it WORKED! It is a matter of switching the parameters.
After following the demo by Feodor, I used this below syntax, and it worked for me. I am using SQL Server 2012 and here is the command:
TYPEPERF -cf "C:\PerfMonCollect\Counters.txt" -si 5 -sc 4 -f SQL -o SQL:SQLdatasource!log1".
Your counters list may be damaged. Run perfmon GUI utility and make sure that you are able to see the counters in there.
make sure your file name is correct. counters.txt NOT counters.txt.txt . show extensions then check the file name. also, you can try the RUN command and paste your target to the text file and see if it works.
I had the same issue and it drove me crazy.
I had this error now and solved it by adding the user running typeperf to local administrators group on the servers that threw the error.
I was getting this error on a server(Windows Server 2012 R2) I had admin rights on, I had to manually build performance counters and it was sorted. Here's the link https://support.microsoft.com/en-us/help/2554336/how-to-manually-rebuild-performance-counters-for-windows-server-2008-6
The problem is that the file should contain only file names, without " quote marks.
Removing all " from counterlist resolved the issue for me.

SQLCMD Syntax error when running script that runs fine in management studio

When I run the this select '$(''test'')' in SQL Management Studio 2008 it returns $('test')
When I run sqlcmd -S SERVER -E -d DATABASE -q "select $(''test'')" on the command line it returns Sqlcmd: Error: Syntax error at line 1 near command '''.
If I remove the dollar sign it works. Is the "$" a special character?
Is this a sqlcmd bug? How can I change the script to get the desired result.
Yes, $(id) has special semantics in SQLCMD: it is a variable substitution. You can run commands like:
sqlcmd /E /S . /v variable=MyTable /Q "select * from $(variable)"
and this will select from MyTable. As you guess, the /v is the switch to define a variable. SSMS on the other hand does not, by default, interpret the SQL for variable substitution. SSMS can be made to do this, by checking the option 'Open query widows in SQLCMD mode'.
For mode details see Using sqlcmd with Scripting Variables.
the command you are trying to run:
select $('test')
is not valid. As you note, when you remove the "$" it works:
select ('test')
I'm not sure what you are really trying to do, you have three " double quote characters, you could try using this command:
select '$(test)'
which would be:
sqlcmd -S SERVER -E -d DATABASE -q "select ''$(test)''"

Resources