How to Execute SVN Update command through SQL xp_CMDShell - sql

I have installed Tortoise SVN on my machine, i want to update my local copy with SVN using SVN UPDATE command. I am using SQL script
EXEC master..xp_CMDShell 'svn update D:\SVN_WorkingFolder'
This script is not executing. May i know where i am doing workng.
Thanks in advances guys.
KumaR

Script execution process won't complete because of insufficient permissions to access network.
We won't get any error message or output redirection.
Steps to give permission: Services--> SQLServer2005--> Properties-->Log on-->This account--> Provide local user credentials. Now restart SQL server then execute above SVN update command it will work. Even we can execute batch file to do this job.

Related

trying to understand xp_cmdShell

I know how to use xp_cmdshell to get a listing of a local directory.
The statement below gives me a list of cvs files in the dir C:\TEST.
I ran the statement in my locally installed SSMS.
EXEC Master..xp_cmdShell 'dir C:\TEST\*.csv /b'
However,
EXEC Master..xp_cmdShell 'dir \\ip-adress\share\folder\*.csv /b'
returns a 'No access'.
But running dir \\ip-adress\share\folder\*.csv /b in my commandshell does return a listing. Apparantly I as a user have sufficient rights. Then why does xp_cmdShell return a 'access denied' ?
Is xp_cmdSHell unusable with shares or has this to do with the account that issues the command? But if I started SSMS locally, should the command not run locally under my WIndowsaccount? Same as in commandshell?
I used a SSIS proxy based on my own credentials but it looks like the machine on which the SQL Server is running, is blocked from accessing that share

xp_cmdshell throwing 'null' but working in command prompt

I am using xp_cmdshell command to process csv file to a folder. My query is as below:
Exec master..xp_cmdshell 'C:\test\mydotnetapp.exe -s:03/09/2020 -t:1 -l:1,2,3,4,7 -d C:\test'
In SSMS this command returns null. But in command prompt when I do:
cd C:\test
mydotnetapp.exe -s:03/09/2020 -t:1 -l:1,2,3,4,7 -d C:\test
The same query is working perfectly fine. A couple of things:
xp_cmdshell is enabled
SQL Server has access to the folder
Only this xp_cmdshell command is not working. my other xp_cmdshell is working fine
Any help on how this can be fixed?
If this is run as part of a SQL Job regularly scheduled, run it as a task outside of SQL Server.
Many production DBAs won't let any process run XP_CMDSHELL given the security issues.
If the CSV is well-formed, it can be mapped into SQL Server as a table (not recommended).
It can be imported directly into SQL Server.
Lastly, many production DBAs won't install any custom process code on a production SQL Server machine. The SQL Server machine is dedicated to running only SQL Server plus the minimum extra needed for security and monitoring.

Unable to run .sql file in SQL Server

I have a .sql dump file 20 gb and I am trying to run it on Mysql workbench using run script and after successful execution, using SSMA I'll migrate the data from Mysql workbench to SQL Server. I have migrated the data this way many times successfully however for 20 gb file it seems very time-consuming. Please let me know if there is any alternate way to achieve this quickly. I have followed the following link:
Steps to migrate mysql tables to sql server using SSMA!
From your Title "unable to run .sql file in SSMS" and "I have a .sql dump file 20 gb" are you trying to open a 20GB .sql in SSMS? That's never going to work. SSMS is a 32bit application, so the maximum addressable memory is 2GB. If you want to run your .sql file, I suggest using sqlcmd.
Open up Powershell, and then run the command below replacing the appropriate parts:
sqlcmd -S {Server Name/ServerIP} -U {Your Login} -i {Your full path to your script}
You'll be prompted for your password and then you the file will be run. So, as an example, you might run:
sqlcmd -S svSQL2017 -U Larnu -i \\svFileServer\SQLShare\Scripts\BigBatchFile.sql
If you are using integrated security, then don't pass the -U parameter for the command.
Edit: This answer is no relevant to the OPs question, as they were using "SSMS" as a synonym for SQL Server, which it is not. I have left this here for the moment so the OP can review my comments, and I will likely remove this answer at a later point.

SQL log in from Cron job

On RHEL 7, I am trying to access a SQL table. When I run the code from terminal I can access the database and the script runs as expected. When I run the same script from crontab I get an error:
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
Here is my code:
getSequence()
{
SQLPLUS=/oracle/app/oracle/product/12c/bin/sqlplus
seq_num=$($SQLPLUS -S $OPS_DB_USER/$OPS_DB_ORACLE_PASSWD<<-EOF
set heading off
set feedback off
select Sequence.nextval from dual;
EOF)
VERSION=`printf "%07d" $seq_num`
}
If the script runs as expected. Make sure the permissions are set correctly on the script so when the cron runs it has the correct permissions to execute the script. Double check your environment variables as well. Here is an example of how I call a proc using a bash script. Hope this helps.
#!/bin/bash
sqlplus -s <<%%
$DBLOG/$DBPWD#$ORACLE_SID
exec "my_proc"();
exit
%%

Sql Server xp_cmdshell Access is denied

i'm trying to run some cmd commands via sql query xp_cmdshell
all was working fine but when i have tried to run this code :
EXEC xp_cmdshell 'net user Test Test2 /ADD'
i found this bad result:
System error 5 has occurred.
NULL
Access is denied.
NULL
NULL
can any one help me ?
sry for my bad english
You don't have permission to run this, instead, speak to your Database administrator.
Run your Command Prompt with Administrative Rights by right click on the shortcut, and Run as Administrator.