Trying to execute the test script that MSDN provides to make sure R is enabled, but it throws the following error,
Msg 39023, Level 16, State 1, Procedure sp_execute_external_script, Line 1 [Batch Start Line 0]
'sp_execute_external_script' is disabled on this instance of SQL Server. Use sp_configure 'external scripts enabled' to enable it.
Msg 11536, Level 16, State 1, Line 1
EXECUTE statement failed because its WITH RESULT SETS clause specified 1 result set(s), but the statement only sent 0 result set(s) at run time.
I have made sure i run the
Exec sp_configure 'external scripts enabled', 1
Reconfigure with override
Statement and then i made sure the configuration setting was set to 1 which it is, and restarted the services inbetween checking and afterwards, but no luck.
I've also made sure i'm not side loading any other R open platform ide's or other versions of SQL Server versions except 2016 developer.
Run:
Exec sp_configure 'external scripts enabled', 1;
reconfigure;
Then restart the service from services.msc or restart your system.
Just restart the SQL Server from 'Services' or restart from Sql Server Management Studio
You have to run RECONFIGURE; after executing sp_configure 'external scripts enabled', 1; query before restarting the server.
Related
I am trying to importing a .bacpac of Azure DB into a locally running SQL Server 2017 Enterprise edition.
SQL Server is throwing the following error. I wonder if somebody could help. Thank you in advance.
Could not import package.
Warning SQL72012: The object [xxxxenter image description here-insights_Data] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Warning SQL72012: The object [2pointb-testing-insights_Log] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Error SQL72014: .Net SqlClient Data Provider:
Msg 10343, Level 14, State 1, Line 1
CREATE or ALTER ASSEMBLY for assembly 'GroupConcat' with the SAFE or EXTERNAL_ACCESS option failed because the 'clr strict security' option of sp_configure is set to 1. Microsoft recommends that you sign the assembly with a certificate or asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission. Alternatively, you can trust the assembly using sp_add_trusted_assembly.
Error SQL72045: Script execution error. The executed script:
CREATE ASSEMBLY [GroupConcat]
AUTHORIZATION [dbo]
FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C01030058898C510000000000000000E00002210B010B00001E000000080000000000007E3D0000002000000040000000000010002000000002000004000000000000000400000000000000008000000002000000000000030040850000100000100000000010000010000000000000100000000000000000000000243D000057000000004000003804000000000000000000000000000000000000006000000C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E74657874000000841D000000200000001E000000020000000000000000000000000000200000602E7273726300000038040000004000000006000000200000000000000000000000000000400000402E72656C6F6300000C000000006000000002000000260
(Microsoft.SqlServer.Dac)
The following script worked for me:
EXEC sp_configure 'show advanced options',1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'clr strict security',0;
GO
RECONFIGURE;
GO
We have a full and diff restore db job created and it is failing with the below error. We have a production server which run the full DB back up SQL jobs of all the DB's and saves them in a different server(example server X) on the server X we restore sql jobs created and when I run them they are failing with this error:
Configuration option 'show advanced options' changed from 1 to 1.
Run the RECONFIGURE statement to install. [SQLSTATE 01000] (Message 15457)
Configuration option 'xp_cmdshell' changed from 1 to 1.
Run the RECONFIGURE statement to install. [SQLSTATE 01000] (Message 15457)
Can anyone please assist on this?
I am trying to export from my Table data into Excel through T-SQL query. After little research I came up with this
INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=G:\Test.xls;',
'SELECT * FROM [Sheet1$]')
SELECT *
FROM dbo.products
When I execute the above query am getting this error
Msg 7302, Level 16, State 1, Line 7 Cannot create an instance of OLE
DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
So went through internet for solution, got the below link
https://blogs.msdn.microsoft.com/spike/2008/07/23/ole-db-provider-microsoft-jet-oledb-4-0-for-linked-server-null-returned-message-unspecified-error/
In the above link they were saying like we need to be administrator to create folder in C drive TEMP folder since OPENROWSET creates some files or folder inside TEMP folder
I am doing this in My Home PC and I am the administrator. Still am getting the same error.
SQL SERVER details
Microsoft SQL Server 2016 (RC1) - 13.0.1200.242 (X64) Mar 10 2016
16:49:45 Copyright (c) Microsoft Corporation Enterprise Evaluation
Edition (64-bit) on Windows 10 Pro 6.3 (Build 10586: )
Any pointers to fix the problem will be highly appreciated
Update : Already I have configured the Ad Hoc Distributed Queries and
Executed the below queries
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.Jet.OLEDB.4.0', N'AllowInProcess', 1
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.Jet.OLEDB.4.0', N'DynamicParameters', 1
GO
now am getting this error
Msg 7438, Level 16, State 1, Line 7 The 32-bit OLE DB provider
"Microsoft.Jet.OLEDB.4.0" cannot be loaded in-process on a 64-bit SQL
Server.
I have MS Sql server 2012, and Office 2013. This seems to be very finicky, so you may have to adjust to your particular versions.
Download the Microsoft.ACE.OLEDB.12.0 for Windows, 64 bit version found here: https://www.microsoft.com/en-us/download/details.aspx?id=13255
Install it on your server.
Check the user running SQL Server and make sure that user has access to the temp directory C:\Windows\ServiceProfiles\LocalService\AppData\Local\Temp if it's a local service account or C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp if it's a network service account.
Configure 'Ad Hoc Distributed Queries' and enable the Microsoft.ACE.OLEDB files like this:
Here's the SP_CONFIGURE commands:
SP_CONFIGURE 'show advanced options', 1;
GO
RECONFIGURE;
SP_CONFIGURE 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParam', 1
On newer SQL Server 2014 You had use 'DynamicParameters' instead of 'DynamicParam'
EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
Make sure you register msexcl40.dll like this:
regsvr32 C:\Windows\SysWOW64\msexcl40.dll
Check out sp_configure /RECONFIGURE...
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO
See these links for more info:
https://technet.microsoft.com/en-us/library/aa259616(v=sql.80).aspx
http://blog.sqlauthority.com/2010/11/03/sql-server-fix-error-ms-jet-oledb-4-0-cannot-be-used-for-distributed-queries-because-the-provider-is-used-to-run-in-apartment-mode/
Works !!! Great thanks.
Just for 64-bit Win server 2012R2. Let me put the whole working script partially repeating bits from above which are not easy (as for me) to combine together:
Download the Microsoft.ACE.OLEDB.12.0 for Windows, 64 bit version found here: https://www.microsoft.com/en-us/download/details.aspx?id=13255
Create excel file with respective columns (name and class in this case).
Run code below:
sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
-- Until SQL Server 2012
EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.Jet.OLEDB.4.0', N'AllowInProcess', 1
-- SQL Server 2014 or later
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.Jet.OLEDB.4.0', N'DynamicParameters', 1
EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
-- Now you can export to Excel
INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 8.0;Database=C:\testing.xlsx;',
'SELECT Name, Class FROM [Sheet1$]')
SELECT [Name],[Class] FROM Qry_2
GO
-- Or import from Excel
select * from OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 8.0;Database=c:\targetWorkbook.xls;',
'SELECT * FROM [targetSheet$]')
Please Execute the below queries to fix this problem:
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.Jet.OLEDB.4.0', N'AllowInProcess', 1
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.Jet.OLEDB.4.0', N'DynamicParameters', 1
GO
I am evaluating SQL Server 2016 in-database integration with R on Windows 10. I have followed the steps installed all components and scripts. Now I have following questions:
Where does sp_execute_external_script reside? I can’t find it.
When I run script, for example:
execute sp_execute_external_script #language = N'R' , #script = N' OutputDataSet <- InputDataSet;' , #input_data_1 = N' SELECT TOP 100 [BusinessEntityID] FROM [AdventureWorks2014].[Person].[Person];';
I got error:
“Msg 39021, Level 16, State 1, Line 1 Unable to launch runtime for 'R'
script. Please check the configuration of the 'R' runtime. Msg 39019,
Level 16, State 1, Line 1 An external script error occurred: Unable to
launch the runtime. ErrorCode 0x80070490: 1168(Element not found.).”
Based on the above suggestion, I rerun the script, but it does not solve the problem.
Any suggestions are greatly appreciated.
RegisterRExt post installation configuration needs to specify the correct instance name as per this MSDN article .
You can run the following commands to fix your issue:
"%programfiles%\RRO\RRO-3.2.2-for-RRE-7.5.0\R-3.2.2\library\RevoScaleR\rxLibs\x64\RegisterRExt" /uninstall
"%programfiles%\RRO\RRO-3.2.2-for-RRE-7.5.0\R-3.2.2\library\RevoScaleR\rxLibs\x64\RegisterRExt" /install /instance:InstanceName
sp_execute_external_script is in the Extended Stored Procedures node in the 'master' database of the installed instance of SQL Server 2016
Can you please confirm you ran both R provider installation & Post-installation steps below?
Install R Packages and Providers for SQL Server R Services
Post-Installation Server Configuration (SQL Server R Services)
If you are still facing errors, can you share log from RegisterRExt.log from this location:
"%programfiles%\RRO\RRO-3.2.2-for-RRE-7.5.0\R-3.2.2\library\RevoScaleR\rxLibs\x64\RegisterRExt.log"
For SQL Server 2016 official RTM release I've found that a similar error (but with "incorrect parameter" instead of "Element not found") was caused because I moved the working directory in the R config file to have directory without spaces, but you need also to create inside it other working directories, from SQL201601 to SQL201620, as it was in the original confi directory.
Regards
Massimo
i am trying to open a .exe file from within an sql query or Job.
im using xp_cmdshell , it is enabled on the server
the .exe runs properly when i double click on it from my windows Explorer
but when i try to open it using xp_cmdshell it returns to me 1 row affected
and the row is null.
the .exe file is supposed to delete all the content from a certain table.
when i run the file from the windows explorer, the .exe deletes all the content of the above mentioned table, whereas when i try using xp_cmdshell the content of the table remain intact, which means the .exe file is not opened.
any ideas?? this is the code i'm using
exec master..xp_cmdshell 'C:\inetpub\wwwroot\Digital_Library_Shamaa\ShamaaConsoleIndexer\Publish\setup.exe'
i have added the permission Everyone to the folder containing the above .exe file and all its sub folders!
1) Run EXEC master..xp_cmdshell 'whoami' to see which user you're trying to run the exe file
2) Did you enable :
USE master
GO
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE WITH OVERRIDE
GO
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE WITH OVERRIDE
GO
3) Did you unblock the file ?