I am trying to edit or view the SQL Agent's job (I am the owner of this job) from SSMS 2005 and I can't find out how to do this. When I am double-clicking a job or entering job's properties I get empty "New Job" window.
Is there some way to correct this behavior?
You can genereate SQL Script for SQL Job and then edit it. right click the job and then
click generate SQL Script. Here you can also change the job properties with the sql sciript
I ran into this problem a while back. I'm not entirely sure what caused it, but the fix was installing sp2 of sql server onto my local machine (or whichever machine you're using ssms on). the only documentation i found at the time suggested that that was the only solution.
I suggest you create a new job explicitly, then try editing your new job the same way and see what happens.
In particular, it's possible that your old job really is empty.
not sure what your issue with SSMS is. Maybe you dont have permission?
Unless your sa you need to be a member of the SQLAgentOperatorRole in MSDB?
If you can still run queries then look at the sysjobs and sysjobsteps tables in the MSDB database, this has all the properties
You can use the sp_update_job to modify the job
Related
This happens frequently to me, SQL Server doesn't recognize my tables.
I tried to refresh the database, also tried to refresh the intellisense. But nothing worked!
Could anyone help please?
You can preface the code with
USE Sales_DB
And it will always start with that database.
Can you ensure that you are not running this against the "master" database? When setting up a user, if a default database is not specified, when you connect using SSMS it defaults to master.. change the db or use the use[your database] statement before you run any other queries.
I backed up my database table's and entire schema into .sql script using Visual Studio's Database Publishing Wizard.
I then tried to re-create those tables on another PC, not before re-creating the database itself, with the same exact name and everything (using a script that I created via SSMS's Script Database as).
I then open that tables .sql file using SSMS and execute it.
SSMS reports:
Command(s) completed successfully
But examining Object Explorer reveals that no tables were created.
Why is this happening?
What have I missed?
I've just been having the exact same problem symptoms also using Visual Studio's Database Publishing Wizard, - but with a slightly different cause / fix.
Even though SQL Server Management Studio says it is connected to the correct database (in the drop down in the ribbon, and in the status bar of the window), it wasn't actually connected to anything.
To identify and fix either:
SELECT DB_NAME() AS DataBaseName
If you get
master
(or any other unexpected database name) as the result, then you are connected to the wrong database and should select the correct DB from the dropdown. This was the cause of your problem.
If you get
Command(s) completed successfully
then somehow you aren't connected at all - this happened to me.
To fix, click the "change connection" button to disconnect and reconnect.
Check whether you have selected database. Most of the times we execute query in Master db by mistake.
-- Mark as answered if this answer really answered your question
Check if you are running "Execute" or jut Parsing the code. It was a late night, I was tired, and kept running a query to create a table, successfully, but no new table. The next day with a clear mind i noticed that i was not actually running the query, i was parsing it.
I'm running the copy database wizard on a 2008 R2 instance of SQL Server.
The database I want to copy is a SQL 2000 database.
I'm copy that database to another SQL SErver 2008 R2.
The wizard uses SQL authentication for both servers, and both are sysadmins.
When I run it, I get the following error (FYI I have tried both copying the logins and leaving them out):
Event Name: OnError
Message: ERROR : errorCode=-1073548784 description=Executing the query "sys.sp_addrolemember #rolename = N'RandomRoleName..." failed with the following error: "The role 'RandomRoleName' does not exist in the current database.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
helpFile= helpContext=0 idofInterfaceWithError={C81DFC5A-3B22-4DA3-BD3B-10BF861A7F9C}
StackTrace: at Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
Any help would be appreciated!
Jim
My suggestion is dont use the copy database wizard. Create a full backup of the database on the 2000 server and then restore it on the 2008 server.
If you google "Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer Copy Database Wizard" you will find that many many people have gotten this same error or other nearly identical smo errors... no-one appears to have gotten past it.
That's isn't to say its impossible... just, restoring a backup is so much easier then the wizard or troubleshooting the wizard. Good luck.
The copy wizard had missed some security and IIRC it's caused by subtle differences in security tables, principals etc between the 2 versions.
Frankly, the easiest way is to do one of these two:
backup/restore
detach, copy, attach
If you don't have access to the O/S and can't get it, another option is to create the missing role(s) in the background as the copy runs. You have to catch it between the creation of the files and when it tries to reference the roles, but there are a few seconds in which to create them if you keep clicking execute - I managed to create 9 roles.
Unfortunately, you'll end up with the roles in another database too (while yours cannot be used) so those need to be deleted.
Of course, this is only an option when you really can't use the other method.
Though the answer which is using the backup technique solves the problem generally, after facing the same issue several times, I was able to trace down the root of the problem using the Event Viewer of Windows to that the Database Copy wizard, using the SQL Agent, will eventually create a Job for the agent to run, after which the Agent will run using its own credentials (i.e. the credentials that you can look up in Windows Services, in my case, NT Service\SQLAgent$SQL2014)
All you need to do is to go the folder where SQL Server creates DB files (e.g. C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA by default for SQL 2014) and give the SQL Agent windows user write/read access on the folder.
The reason can be that a file with the new Database name already exist on the filesystem. We encountered this when we renamed Database X to X_Old, and tried to copy database Y to X. This cannot be done, because database X_Old is still associated with the filename X.
Either delete the conflicting database, or rename the file on the file system.
See http://codecopy.wordpress.com/2012/01/03/error-while-copying-a-database/
I have a SSIS package I am trying to schedule. I create a new job under SQL Server Agent. On the Command line tab of the jobstep, I choose "Edit the command-line manually".
The changes are retained as I switch from tab to tab within the job step but whenever I exit and save the job, the changes are lost.
Any ideas what's going on?
I'm on SQL Server 2008.
This is a confirmed bug, but here's a workaround that my team uses:
1) Script the create job statement (without your edits)
2) Delete the job from SQL Agent
3) Perform your edits in the create script
4) Execute the create job
This will allow you to keep your manually modified command line options.
There is a bug with the Set Values properties in SQL Server Agent for SSIS packages. You need to save the job step while still on the tab I think(?). I'll see if I can remember and reproduce the steps, but you're not going crazy. ;)
You may need to click "OK" for the job step, and "OK" for the job before moving on to any other changes in the job.
try a copy save as on the package and save change the protection level to encrypt sensitive data with password
I had the same issue when trying to append /DumpOnError to the command line tab of the only step in a job. What I realized was that the change was really performed. And I found it out by generating the "create job" script. What was happening then? Well, it seems as if in the edit box of the command line tab you always got the "default" configuration, however the real one is. I checked it on three installations. 2008 standard, 2012 enterprise and 2017 enterprise.
Is it possible to change a sql server instance name? Or is it something that can only be set during installation?
To the best of my knowledge, they can only be changed at install time. You might be able to change the name with the installer package while keeping the current info. I would make backups of all of your databases and then try this.
On another note, changing instance names will just cause you so many headaches. Even if you can do it, I would strongly reccomend leaving well enough alone.
You can't rename the instance but you can rename a server (sql2000 only) - does that help at all?
Have a look at:
sp_dropserver 'oldname', 'droplogins'
and then;
sp_addserver 'newname', local
Be aware that if there are any jobs running on that server they'll need to be renamed too;
use msdb
go
update sysjobs set originating_server = 'newname'
You'll need to restart your SQL Server