How to fix the error that occurs during execution of the package deployed on a server? - sql-server-2005

I've created a dtsx package with Sql Server Business Intelligence Development studio, and I am executing it using the dtexec utility. Using dtexec I am setting certain properties at runtime using the /set switch. So my command looks something like:
dtexec /f "mypackage.dtsx" /set
\Package.Connections[Destination].Properties[UserName];myUserName
This works perfectly when I run it on my local system (the one it was developed on). Unfortunately, when I copy this package to a different system and attempt to run this exact same command, I receive the following error:
Warning: The package path referenced an object that could not be found:
\Package.Connections[Destination].Properties[UserName]. This occurs when an
attempt is made to resolve a package path to an object that cannot not be found.
The new system that the package was moved to has SSIS installed and is running the same version of Sql Server as my local system (SP2). Maybe I'm misunderstanding something about the intended use of dtsx packages, but I really don't see how/why this is happening.

This steps is for creating an XML configuration file (.dtsConfig) which can keep your sensitive data, like the password of your connection string, without having a Protection Level that can make you difficult to move the package from one machine to another.
In this example, assumed you have an OLE DB Connection to an SQL database called MyDb.
Control Flow, Property: set "ProtectionLevel" to "DontSaveSensitive"
Control Flow, right-click empty space to get menu: click "Package Configuration"
Package Configuration Organizer: tick "Enable package configuration"; click "Add"
Package Configuration Wizard, Select Configuration Type: set "Configuration type" to "XML configuration file"; choose "Specify configuration directly" radio button; click "Browse..."
Select Configuration File Location, fill "Filename": [PackageName].dtsConfig (easy if same folder and same filename as the package itself, just different extension); click "Save"
Package Configuration Wizard, Select Configuration Type: click "Next >"
Package Configuration Wizard, Select Properties to Export: traverse the following tree nodes and tick its checkbox; click "Next >"
\[PackageName]\Connection Managers\MyDb\Properties\Connection String
\[PackageName]\Connection Managers\MyDb\Properties\Password
Package Configuration Wizard, Completing Wizard, click "Finish"
Package Configuration Organizer: click "Close"
Solution Explorer: right click the root tree for menu, click "Add", "Existing Item...", click [PackageName].dtsConfig, click "Add"
Solution Explorer: double click \Miscellaneous\[PackageName].dtsConfig to load into editor;
Main menu: click "Edit", click "Advanced", click "Format Document"
Traverse the XML tree node: \DTSConfiguration\Configuration[Path="\Package.Connections[MyDb].Properties[Password]"]\ConfiguredValue; key in the database password; save the file
Windows Explorer: navigate and double click [PackageName].dtsx
Execute Package Utility, Configuration, click "Add", double click [PackageName].dtsConfig, click "Execute"
When required to move the .dtsx to another machine, simply accompany it with its .dtsConfig. Hope this helps.
Cheers, Ari.

You'll need to create a deployment utility if you;re moving the package between machines. Your connection information gets encrypted using a key specific to your machine.
If you go to the project properties in VS, Select the deployment utility section and set the CreateDeploymentUtility option to true. This will create the deployment utility in the bin folder, you can then copy all that to the new machine, run the installer, and all should work fine.

The quickest way to move packages between machines and avoid all the signing of the packages is the following.
In Visual Studio with the package open select "Save copy of PackageName" As
You then get a wizard up. Easiest one is probably to just select file store. Then at the base of the wizard you will see protection level. Select Encrypt Sensitive data with a password. Enter a password.
On the server you wish to move it to select Import Package and it will prompt you for the password. Enter it and your connection information will be correctly move to the new server.
Definitely not best practice but it is a good method for quickly moving things around test servers.

On your control flow properties, there is a property called "ProtectionLevel". If you set this to 'DontSaveSensitive' then that might cause you less headaches while doing dev and testing. For production scenarios where security is a requirement then you might need to find another solution.

Here are the guidelines from MSDN about package security. Setting the Protection Level of Packages

Related

How to restore a database from bak file from azure data studio on Mac

Previously on Mac I use mysql operation studio and I click on database and click restore then browse to my bak file, but now they change to azure data studio and when I repeat the same steps I got this error:
"You must enable preview features in order to use restore"
but I cannot figure out hot to enable that. I have googled and tried few things even open my azure, microsoft account on website but I do not see that option.
Can some one help please !
Go to Azure Data Studios > Settings
Edit settings by clicking on
"new settings editor"
Search for "preview"
Scroll to the bottom and
check "Enable unreleased preview features"
Adding this as an answer as I don't have enough rep to comment. This is in response to the question in the comment for the answer to the OP (If that's not confusing enough!)
This only applies when your sql database is hosted on a Mac/Linux/Docker Container. We don't have any Windows servers in our estate for me to test this on to see if the location of the .bak files is any different.
When you click on the "..." button, it browses to /var/opt/mssql/data on the machine (or docker container) the database is hosted on. This is not an issue if you are backing up & restoring databases on the same host, however, if you're migrating to a new server or just creating a dev/UAT/staging environment, it becomes a problem because you don't have access to var/opt/mssql/data.
This is a bit of a sledgehammer to crack a nut type solution but as I'm working with 2 dev boxes, it doesn't make a lot of difference to me.
To make this easier to understand I'll call the server that hosts the database you have backed up ProdServ & the server you are restoring to DevServ.
On DevServ, at a terminal prompt, navigate to /var/opt and make a note of the current permissions on the mssql directory (mine were drwxrwx---).
$ cd /var/opt
$ ls -la
Google the octal value for your permissions (in my instance, it's 770)
Change the permissions of the data directory to rwxrwxrwx.
$ chmod -R 777 /var/opt/mssql/data
(You will also need to do this on ProdServ if that is also a Unix-based o/s)
Copy the .bak files from ProdServ to DevServ via a method suitable to the environment you're working in.
Windows --> Linux I'd use WinSCP
For Mac to Docker, docker cp <fileToCopy> <container>:<destinationPath> works perfectly fine.
Once the files have been copied over, they will magically appear when you click the "..." button in azure data studio again. Make sure you change the directory permissions back to their original value via the same command. So in my instance, simply
$ chmod -R 770 /var/opt/mssql/data
As an extra note, if you're used to working in MSSMS, the wizard there allows you to create a database from a .bak file, from what I can see, Azure Data Studio does not. You have to create the database first (CREATE DATABASE <databasename>) in a query window, then restore the .bak file to it.
simple add this to your setting file:
"workbench.enablePreviewFeatures": true
You can click on View at the top menu next to Window.
Then select the first option Command Palette
Then in the command textbox type Restore and select Restore
Then the restore window comes up.

PDFCreator installation crash

I am currently trying to install PDFCreator 1.6.2 on my computer (Windows 7 64bits).
I have to use this specific version and not another one due to compatibility issues with another program.
I launch the setup in administrator mode, check "Expert settings"
I accept the agreements
I choose the Server Installation
I Click on "next", let the default printer's name "PDFCreator"
I do not check the box "Windows 2000/XP/2003 - 32bit" and click next
I choose the directory in which I want to install it (C:...\PDFCreator)
I just uncheck "PDFArchitect" and let everything else by default
I let the program's shortcut name in the start ùmenu folder by default (PDFCreator)
At the next page I also let everything by default (create a desktop icon for all users, create an entry in the Windows Explorer context menu)
Click on next, the summary of the installation is displayed, click on Install
The bar goes through the end, then "Create an entry in the Windows Explorer context menu" is displayed and a error pop-up appears which says "During the printer installation errors have occured. A detailed description can be found in the file "SetupLog.txt" in application path.
I click on "OK", and the last setup page is displayed. I uncheck all the boxes (launch PDFCreator, SetupLog.txt, show help), click finish and the setup crashes.
PDFCreator does not appear in the printers and if I try to add one manually by clicking on "add a printer", select "add a local printer", "create a new port", port type : "pdfcmon", I can click on "next" but it has no effect so I am a bit stuck.
Do you have an idea why does the installation crashes ?
Is there a workaround ?
The content of the file "SetupLog.txt" is available here :
SetupLog.txt
I've so far been unable to reproduce your problem despite numerous test installs (and uninstalls) of v1.6.2 on a Win7 64-bit box. Your posted log indicates that the process successfully created the pdfcmon port, but then apparently lost it afterwards (or else never created it, but misread its own return status):
Install printerport:
Portname : pdfcmon
Result: Success
[...]
InstallPrinter:
Printername: PDFCreator
Drivername : PDFCreator
Portname : pdfcmon
Result: Error 1796 = Le port spécifié est inconnu
It's reasonable to assume that nothing useful will occur beyond that point, so you'll need to address error 1796 first. A quick Google of that error code leads to a number of queries at PDFForge.org about it:
http://forums.pdfforge.org/search?Search=1796
Not all received replies, but one involving 2003 Server in particular did:
you need the latest service pack for Server 2003, then it should work.
Elsewhere in your log file I see references to some older software (e.g. Internet Explorer version: 9?) which leads me to think that you might want to doublecheck that all your relevant service packs and software are up to date first, then try your installation again.
Nevermind, I gave up installing PDFCreator, I have a server on which I could install it without any problem so the problem is kinda fixed
I still don't know why it crashed but that's not relevant anymore.
Sorry for making some of you wasting their time

Debugging in OpenERP 7.0

How to do debug in OpenERP v7?
In previous versions of OpenERP, it was easy to debug. But in the latest version it's tough to debug.
To debug your OpenERP+python code in eclipse, start eclipse (helios/indigo only) in debug perspective and follow the given steps:
1: Stop your openERP running server by pressing "ctr+c".
2: In eclipse go to Menu "Run/Debug Configurations". In configuration window under "Python Run", create new debug configuration(Double click on 'Python Run').
3: After creating new debug configuration follow the given steps:
3.1: In "Main" tab under "Project", select the "server" project or folder (in which Openerp Server resides) from your workspace.
3.2: Write location of 'openerp-server' under "Main Module".
Ex: ${workspace_loc:server/openerp-server}.
3.3: In "Arguments" tab under "Program Arguments", click on button "Variables" and new window will appear.
3.4: Then create new "Variable" by clicking on "Edit Variables" button and new window will appear.
3.5: Press on "New" button and give your addons path as value.
Ex: --addons ../addons,../your_module_path
3.6: Press Ok in all the opened windows and then "Apply".
4: Now into "PyDev Package Explorer" view go to 6.1/server and right click on "openerp-server" file, Select 'Debug As --> Python Run'.
5: Now in "Console" you can see your server has been started.
6: Now open your .py file which you want to debug and set a break-point.
7: Now start your module's form from 'gtk' or 'web-client' and execution will stop when execution will reach to break-point.
8: Now enjoy by debugging your code by pressing "F5, F6, F7" and you can see value of your variables.
You can refer following link: Debug OpenERP Code from Eclipse
Go to Administrator(in right top corner) in that click on About OpenERP in that you will find a link Activate the Developer Mode.
or
you can add a parameterdebug in of URL like
http://localhost:8069/?debug
both the way will let you open the developer mode.
You can also use the Odoo Debug pro chrome extension to toggle the developer mode using the keyboard shortcuts.
To debug openERP 7 from eclipse just Stop openERP server and rename the main file named openerp-server.py.From "Run/Debug Configurations" make a new configuration selecting Project and main module such as ${workspace_loc:openerp7/src/openerp-server.py} then press Apply.After that /openerp7/src/openerp-server.py 'Debug As --> Python Run' using new configuration.Server is running where pydev debugger is also started.Now run 'gtk' or 'web-client'.Then select the python file of that module where want to debug and give breakpoints.That's all.
Debugging is quite simple in interface.
For Programmers
By Default when you login to openerp, your url will look something like this
http://localhost:7373/?db=Test_July_25#menu_id=107&action=97
Edit the url and add debug=&
localhost:7373/?debug=&db=Test_July_25#menu_id=107&action=97
For Functional Users
Navigate mouse to top right corner and select About OpenERP
Now Activate Debug Mode
You Should be done now with interface debugging.
For Code Debugging (along with arya's method these images may help you)
You can use browse button to select the project and the openerp server file
Finally place breakpoints in your code where ever necessary
Navigate through
administrator(top Right)>>about OpenERP
Dialog Open Click on Activate Developer mode
Their is more complexity and less control by adding more fancy tools try and go low level and use python pdb and if you are debug geek then use winpdb with pdb which gives extreme contorl over your code navigation.
And for simple value abd flow use print or pprint module from python.
Bests.
Start debug mode on browser ??
In URL you can type ?debug after web
OR
go to About OpenERP select Activate Developer Mode
If You want to debug from eclipse then
go to PyDev Package Explorer --> openerp(odoo) --> Right click on openerp-server file
Select Debug as --> Python Run
It will ask for change current perspective from PyDev to Debug click "Yes" and its Done
Activate the Debug mode and use some print statements to debug the variable values

SQL Server Management Studio error "Saved settings file cannot be found"

Here is my problem:
Every time I start the "Microsoft SQL Server Management Studio", I get a warning
The automatically saved settings file "\\Settings\CurrentSettings-2012-02-13.vssettings' cannot be found.
The message goes on to say :
"You can change this file on the 'Import and Export Settings' Tools Options page". The IDE will use your most recent settings for this session.
Where is this setting? How to fix this?
thanks!
you can try with theses steps :
In the Tools menu, select Options.
Select Environment folder, choose Import and Export Settings
In Automatically save my settings to this file, enter the location you will backup.
Select OK.
This file is in : %userprofile%\Documents\Visual Studio 2008\Settings\CurrentSettings.vssettings
Nota : if you don't find file, you can get another file from your coleague
If SQL Server Management Studio is open close it
Open Registry Editor Navigate to the location
_HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL
Server\100\Tools\Shell_
Edit the value of the Reg Key "VisualStudioLocation" to
%USERPROFILE%\Documents\SQL Server Management Studio
Close Registry Editor and check if the problem is fixed
In my case: we have Documents folder as mapped network drive and it seems SQL management studio has issues with that. As a quick workaround I created settings file outside this network drive and it works. Only downside is settings are not synchronized but honestly I don't care :)
Use your favorite registry editor, or use regedt32.exe if you don't have a decent one. Navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<vsver>\profile, where <vsver> is the numeric version of visual studio that you are using, e.g. 6.0, 7.1, 8.0, 9.0. In there, you will find an entry AutoSaveFile. Edit this entry to point to a vssettings file that you want as your default settings file. If you don't have such a file, create one via "Tools->Import and Export Settings...->Export selected environments settings" first. Typical value for AutoSaveFile is %vsspv_visualstudio_dir%\Settings\CurrentSettings.vssettings, and typical value for DefaultSettingsDirectory is %vsspv_visualstudio_dir%\Settings\.
The statement in the error message "You can change this file on the 'Import and Export Settings' Tools Options page" seems to be incorrect. In particular, I was unable to reset the defaults no matter how many different ways I saved or loaded settings using the 'Import and Export Settings' Tools Options page. I had to resort to modifying the registry.
I had the same problem.
Turns out I had renamed the drive and this was causing the problem. Renaming it back to the original (as seen in the path in the error message) fixed the issue.
I managed to fix it with no registry changes.
Based on the instructions from this site:
http://sebastian.expert/the-automatically-saved-settings-file-currentsettings-vssettings-cannot-be-found/
Basically you need to change the default path in options.
Go to Tools/Options then Environment/Import and Export Settings
Change the path to existing one.
I found a lot of solutions which suggested to edit the following registry: HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\100\Tools\Shell\VisualStudioLocation
If there are people(like me) who do not have that entry, I managed to fix it by editing this one:
HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\100\Tools\Shell\Profile\AutoSaveFile
I run MS SQL Server 2008 R2

How to open multiple .sql files in only one ssms instance

I'm DBA with a new server box running Windows Server 2008 Enterprise SP1 with SQL Server 2008 and SQL Server Management Studio.
In my previous box when working in Visual Studio with database solution with lot of .sql files I used to double-click on the .sql files and they were opened in the same SSMS instance (if any already opened). However (even when having exactly the same installation in the new box) I'm now getting a new SSMS instance when double clicking in each sql file. Its really painful one .sql - one SSMS instance so I started my research about that.
What I've tried till now:
1) Right click on the .sql file > "Open With" option > "Add" option > "Program Name: C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" and "Friendly Name: SQL" > "Ok" > "Set as Default". Does NOT work. Still having one sql - one ssms instance.
2) Perfomed Run > regedit > and modify the value data of HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\Command and replace /dde with "%1". DOES NOT WORK
3) Right click on the .sql file > "Open With" option > "Add" option > "Programe Name: explorer.exe" and "Friendly Name: Explorer" > "Ok" > "Set as default". Does NOT work. When double-clicking on the .sql files Notepad comes with scripts content.
4) Some pages like this
http://social.msdn.microsoft.com/Forums/en/sqltools/thread/ac2f39c5-66e5-495c-b7a6-47e743853baf
asks to change file association but when opening Windows Explorer > Tools > Folder Options ... I found there is no "File Type" tab. How annoying!
Can someone help me on that? My patient it's really running out.
Thanks in advance
After spending most of my working day looking for the solution I finally found it. Thanks God, I was almost running out with this issue. Hope it helps somebody else!!!.
Update: linked domain expired, so here's what it said:
Considering how integrated Microsoft tools usually are the result is
frustrating when you tell Visual Studio to open SQL files using Sql
Server Management Studio (SSMS). I really don't like using Visual
Studio to edit T-SQL files but in the past, before I discovered this
tip, each SQL file I opened would open in a new instance of SSMS. Try
it:
Open a solution which contains SQL files
Right-click any SQL file and select “Open With…”
Click “Add”
Browse to "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" or if you're
running x64 Windows "C:\Program Files (x86)\Microsoft SQL
Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe", then click “OK”
Click “Set as Default” and then “OK”
Now open multiple SQL files. Each time you'll get a different instance
of SSMS opened. What a pain!
NOTE: This entire article applies to SQL 2005, just replace SSMS with
SQLWB.
How do you resolve this? Repeat steps 1-3 above, but at step #4 enter
the following values:
Program Name: “explorer.exe”
Friendly Name: “Windows Explorer”
Repeat step #5 (set as default) above and then click OK. Now, open
additional files. They should all open in the same instance of SSMS.
It would seem that Visual Studio issues a command to SSMS.exe which
includes the path of the file selected in the solution explorer. It is
up to SSMS to check for a new instance, which it doesn't. But when you
pass the file name to explorer it gets opened up in the same instance.
QUIRK WARNING!
If SSMS is not already open, the first file you attempt to open (not
first time ever, but every time you open an SQL file from Visual
Studio and SSMS isn't open yet) SSMS will open, but your file will
not. Click the file a 2nd time and it will open the file this time.
Don't ask me to explain it it just is (and I have no idea why).
Conclusion
The result when you tell Visual Studio that SSMS is the default editor
makes sense, but I don't get why it would be different when you tell
explorer to open it. Maybe if I were a Windows developer instead of a
web developer I would know the answer. But either way, now you know.
Enjoy.
I have this problem before, I found there is a simple solution -> just check if your SSMS is under "Run this program as an administrator" option (right click on the shortcut icon -> property -> Compability -> Privilege level). If yes, untick the option and try double click the sql file.
Hope this helps.
Similar issues have been reported multiple times, but they aren't addressing the issue (removed links because Microsoft erased Connect without much thought):
~connect.microsoft.com/VisualStudio/feedback/details/105575/multiple-instances-of-sqlwb-exe-when-management-studio-set-as-default-editor~
http://web.archive.org/web/20130727043341/http://connect.microsoft.com/SQLServer/feedback/details/622181/multiple-ssms-open-for-seperate-sql-files
~connect.microsoft.com/SQLServer/feedback/details/680761/a-new-instance-of-ssms-is-opened-when-trying-to-open-a-tsql-file-even-when-an-instance-is-running~
Did you install Visual Studio (or any Visual Studio components) after installing SQL Server?
My guess is that the Connect items will not be fixed - SQL will blame Visual Studio, Visual Studio will blame SQL, and the items will remain open...
So here is what I suggest: run a repair of SQL Server from Programs and Features and then re-apply the latest service pack of SQL Server 2008 (SP2).
Also the "File Types" interface was moved from the Tools / Folder Options interface to the Control Panel. Go into Control Panel > Default Programs > "Associate a file type or protocol with a program." However it doesn't seem to have the options here to add command-line options like "%1" or /dde.
Try adding these reg keys as well, but make sure you put the /dde back in:
[HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\ddeexec]
#="Open(\"%1\")"
For the record, here is my entire export for that section:
[HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open]
[HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\Command]
#="\"C:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\VSShell\\Common7\\IDE\\ssms.exe\" /dde"
[HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\ddeexec]
#="Open(\"%1\")"
[HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\ddeexec\application]
#="sqlwb.9.0"
[HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\ddeexec\topic]
#="system"
Go to Tools >> Folder Options >> File Types and apply below settings. It worked for me finally!!! (after half a day search on google).
Click New/Edit (on this window "Confirm open after download" should be check and "Always show extension" should be unchecked)
In next window, make below entries
- Action: Open
- Application used to perform action : Your ssms.exe path like "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"
- Check "Use DDE" check box
- DDE Message : Open("%1")
- Applicajtion sqlwb.9.0
- DDE Application Not Running: Keep it empty
- Topic : system
Regards,
Sandeep Gaadhe
I am using SQL Server Management Studio 2012 Express and I have made this to work by pointing "Program" to "explorer.exe"
This is how my register is set up: "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\ssms.exe" /dde
at
HKEY_CLASSES_ROOT\ssms.sql.11.0\Shell\Open\Command
I've 2005 & 2008 SSMS installed so I defaulted to the 2005 instance. If I have 2008 ssms open when opening a .sql file from windows explorer it will now open in the existing 2008 ssms (and not try to open a new instance!)
From Windows Explorer, one can drag-and-drop selected files (single or multiple) into an SSMS window.
One thing to check is if you have multiple versions of SSMS. If you happen to be working in an older version, double clicking on a file will open the new SSM version. Or whatever the default version is for sql files.
A quick note for users who want to have SSMS always open with Administrator privileges.
Find SSMS in your start menu. Right-click>More>Open File Location.
Once you see the shortcut to Microsoft SQL Server Management Studio * in Windows Explorer, Right-click>Open File Location.
Then Right-click on Ssms.exe>Troubleshoot compatibility.
Then click Troubleshoot program.
Put a tick by The program requires additional permissions then hit Next.
Now it forces you to press Test the program....
Then press Next and then Yes, save these settings for this program.
Arvo Bowen Jan 30 '20 at 15:27
This work perfectly.
I know this is quite an old post and there are loads of different answers with possible solutions. But here's one I think is new (at least to SO).
I suddenly starting getting this behaviour (i.e. each new file would open in a new session) and couldn't figure out why. Turns out it was because in my SSMS session I had an open dialogue which had dropped into the background.
A soon as I closed the dialogue, new files started opening in my original session /facepalm
Maybe everyone knows this already but just in case it saves anyone 20 mins!
My issue with multiple SSMS instances version 19 was fixed by changing HKEY_CLASSES_ROOT.sql Default key to