How to take a backup for the 'connection details' in sqldeveloper? - backup

What is the process to take a backup of all the connection-details (viz. host,port,sid,etc.) in 'oracle sqldeveloper' software.
How can we import these connection details to some other machine ?

The 'oracle sqldeveloper' stores all the connection details in an xml file ie. connections.xml.
If you want to have a backup for the connection details, you will have to navigate to
In windows XP
C:\Documents and Settings\<YourUserName>\Application Data\SQL Developer\systemX.X.X.X.X\o.jdeveloper.db.connection.X.X.X.X.X.X.X\
In Windows 7
C:\Users\<YourUserName>\AppData\Roaming\SQL Developer\systemX.X.X.X.X\o.jdeveloper.db.connection.X.X.X.X.X.X.X\
and take a backup of connections.xml .
Later, if you need to use the same connections on some other machine, you may simply copy the <Reference ...> tags for respective connections.

From Sql developer you can export the connections and then easily import them
Right click connection.
Select Export
Browse to provide it a xml file path to export connection. Select Ok.
Click Import in connections similarly to export.
Select the xml file and all your connections should be imported.
Note : If you are using Connection type as TNS and providing alais then you will have to export tnsnames.ora file separately. Then provide it to sql developer using
Tools -> Preferences -> Database -> Advanced -> Tnsnames directory

Step 1. Right click on connections and choose the Export Connections.
Step 2. In the File Name sections provide the name of connections file you want to save at your local computer. and click OK. your connections xml file will be saved at your provided location.
NOTE: To import the connections in your sql developer choose the Import Connections..

This link Migrating Oracle SQL Developer Connections with Passwords provides a much better way to do it.

Do to unfortunate circumstances, a new Windows profile was set up for me so I lost all my database connections. Fortunately, my old profile folder had been saved under a different name before the new one was set up.
I was able to use the information from two of the above answers and this post to import my connections with passwords.
Steps:
When in SQL Developer, I right-clicked on "Connections" and chose "Import Connections..." as per the answer by #AniketThakur.
I selected the connections.xml file from my old profile. I found it using the answer by #Satyendra.
The Import dialog gives the choice of discarding passwords or entering the key that was used to encrypt them. This is where this post helped. I found the key by searching under the \systemX.X.X.X.X\ folder for a file named product-preferences.xml. Inside that file I searched for an element that looked like:
<value n="db.system.id" v="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
It appears the v value is the key that is needed to decrypt the passwords.
Note: The product-preferences.xml file was under:
\systemX.X.X.X.X\o.sqldeveloper\

(I am using Oracle SQL developer)
1) Go to View -> Connections
2) Right click on Connections -> Export Connections
3) Select the connections that you wish to export. Click Next.
3) Provide name to the file. Say export.xml (Sometimes you need to create a .xml file in some folder and then choose this file using Browse option)
4) If you wish to keep the passwords Saved in the xml file then choose "Encrypt all passwords with a key". Provide Encryption key. This will be used whenever you import the connections.
If passwords are not needed to be exported with the xml file then choose the other option "Remove all passwords from the exported connections"
5) Before clicking on Finish , see the destination of the xml file that is created.
To import the Connections, follow the similar procedure.
:)

Related

Copy database to a new server

Is it possible to copy a database to a new server? I just want to have the database on a new server because I need to make some tests. I didn't have much experience with servers.
Follow this steps :
Run your SSMS
Right click on the database you want to copy
In the Popup menu , go to Taches , then click Offline
Right click on the Database again in the popup menu , Taches -> Detach
Open the folder ..\MSSQL\DATA , copy Yourdb.MDF and YourDB_log.LDF files to the folder of the new Instance.
Now you can Attach both Databases and work on it in both instance.
Another way:
Run Your SSMS
Right click on the Database you want to copy
In the popup menu , Taches -> Copy the database...
Follow the steps on the Wizard
You can select option if you want to keep the database ONLINE when it is being copied.
You can also select option of MOVE or COPY database as well.
When the process is over it will show the success message and database will be copied to another server.
Note:
1- The Copy Database Wizard is not available in the Express edition.
2- The Copy Database Wizard cannot be used to copy or move databases that are/have:
System.
marked for replication.
marked Inaccessible, Loading, Offline, Recovering, Suspect, or in Emergency Mode.
data or log files stored in Microsoft Azure storage.
Also , a database cannot be moved or copied to an earlier version of SQL Server.
Updtae:
If there is no Copy database option , then you can Copy Databases with Backup and Restore.
For more information about it MSDN.
No experience? No problem, backup the database.
Copy it into the target machine.
Restore DB from device >> open the DB backup file.
At this point you have the entire DB without missing any schema objects such as foreign keys.
Finally delete all sql logins that the DB came with and recreate them manually as you test access.
Once you are comfortable with this operation you can go ahead and get more experience using some of the techniques describe above which are recommended if you have a large DB to restore and so on.
How to restore the DB on SQL Server Management Studio
Steps:
1. On “Object Explorer” panel right-click on “Databases” and selected Restore Database
Select “Device” and browse database location.
note: Copy the .bak file locally before restoring.
The DB information will auto-populate the window, you can edit the name of the DB to be restored.
Go to the “Files” page and check the “Relocated all files…” box.
Select existing folder locations for Data and Log files.
HIT OK

HOW TO EXPORT/ IMPORT DB FROM SQL SERVER

I need to export the db including all the tables from SQL Server and then to import it to another computer with SQL Server.
I tried to do:
tasks-> generate scripts
But when I tried to import this db
by attach he doesn't recognize this file.
how should i do it correctly?
we did our project on my friend computer but i want to get it for myself to...
What you tried is to generate the scripts in order to create the database structure (if you want to use these scripts you need to execute them from SQL Management Studio on your other computer). That's a good solution if you only want to create the database structure on another computer.
If you want to restore the database on another computer with all the structure and data of your database, right-click on your database from SQL Management Studio -> Tasks -> Back Up.
After creating a backup of your database you simply need to copy the generated file to another computer and proceed the restore process.
Here is a link that explains the entire process: Create a Full Database Backup
Hope this will help you.
You can use Backup\Restore technique to make exact copy of your database, But like you said, you only want your tables to be transferred so you can use 'SQL Server Import Export Wizard' for the same.
Right Click on db -> tasks -> Export data
Using above option you can store all data into a flat file also and take that flat file to destination and import the same.

How do I connect to a database in LabView

I've created a new database using Microsoft SQL Server Management Studio, and now I want to interact with it through LabVIEW. I already have several VIs to interact with a previous database, using the database connectivity tool kit. This database was created by someone who has since left the project and I can't find it in anything but LabVIEW.
I'm quite experienced with LabVIEW, but completely new to and bewildered by databases.
Thank you in advance.
The first Connectivity Toolkit VI called should be Open Connection.
The existing code (VI) will either use a file or a string as an input.
If the input is a string, then you will need to create a new connection string compatible with your server. You can find common SQL Server strings at https://www.connectionstrings.com/sql-server-2008/
If the input is a file name, you can copy the .UDL file that is referenced and then modify the copied file by opening it (double click) and then select the OLE DB Provider for SQL Server and then set the connection options to point to your server, database etc. and then test the connection.
Basically the workflow you have to go through is the following:
Open connection
Execute your query
Fetch data (if needed)
Close connection
If you search for "Database" in the NI Example Finder shipped with Labview you will find a few good starting points.
In particular give a look to Database Connection.vi and Database Fetching.vi.
If you plan to use transactions try also Database Transaction.vi.
I found that the solution to my problem was to create a .udl file and use that as the file path for opening the database connection.
Here's the address that taught me how to do this:
http://msdn.microsoft.com/en-us/library/e38h511e(v=vs.71).aspx
Thank you to everyone who submitted answers, they certainly helped point me in the right direction.

Saving and accessing SQL databases in Azure?

A friend of mine has 3 small SQL databases on her Azure account that she asked me to download for her. I said no problem…thinking she had a VM running with SQL Server and I could just RDC in and grab everything…no such luck and no FTP access.
I've done an export but have no idea how to download the .bacpac file.
I've logged in through the management portal - but there's no options in there to export/download anything.
Can someone tell me the best - easiest - way to save these databases? Is there an easy way to download them? If I configure a VM in her account can access them that way? Is there a way I can transfer them over to my account?
I don't know all that much about Blob storage and container management - I've seen a few instructions and they seem very complex to me just to download a .bacpac file so I'm assuming I'm missing something.
Any help or ideas would be great!
Thank you...
Rob
Here is a solution to your problem.
Use a linked server connection between your on premise database and SQL AZURE.
http://blogs.msdn.com/b/windowsazure/archive/2012/09/19/announcing-updates-to-windows-azure-sql-database.aspx
Quick list of steps.
1 - Link to SQL Azure database.
2 - Script out objects.
http://craftydba.com/?p=4827
Check out how to manage Azure from SSMS on my blog. Half way down, right click table, script as Create.
http://blogs.msdn.com/b/sqlazure/archive/2010/05/24/10014071.aspx
How to script a whole database.
3 - Create mirror database on premise using scripts from step 2.
4 - Create linked server to AZURE database.
http://msdn.microsoft.com/en-us/library/aa560998.aspx
5 - INSERT INTO SELECT * FROM
http://technet.microsoft.com/en-us/library/ms174335.aspx
Why select * into does not work in Azure. Might work with a linked server. Never tried.
http://blogs.msdn.com/b/windowsazure/archive/2010/05/04/select-into-with-sql-azure.aspx
6 - Watch out for constraints such as primary key on identity column. You will have to enable identity insert. Other constraints, you can disable.
7 - Re-enable constraints with checking.
Again, this whole process assumes you do not have a ton of data. If you do, you might want to look into using a ETL tool such as SSIS.
You can mount the Azure Page Blob as an NTFS drive using a utility like XDrive. I'm trying to use "Azure Storage Explorer" to do the same thing but it's not allowing me access to the files inside of the VHDS file (and I think that it should). XDrive is supposed to allow for a mapped drive type feel in Windows Explorer.
Backup the databases to the secondary hard drive on the Vm's. Download, install, and configure XDrive to point to this hard drive. Grab the backups. Voila! Please note that XDrive limits read/write access to distributed enviornments so this should only be used as a tempory solution for environments not distributed (ie. load balanced) or you could cause a disruption to your production users.
XDrive: http://blog.maartenballiauw.be/post/2010/02/02/Using-Windows-Azure-Drive-%28aka-X-Drive%29.aspx
Updated:
Download "Azure Storage Explorer" from http://azurestorageexplorer.codeplex.com/
From the Azure portal, click on the db you want to export and from the dashboard tab, there's an "Export" button. This will create a bacpac file.
Choose a storage account (remember which one you chose because you will have to access it later).
For the container, create a new one called "DB Storage" or something like that. You will need to server credentials to do the export.
After the export completes, open up "Azure Storage Explorer" and add the storage account you placed the backup in. You will need the storage account name and the primary key (both can be pulled from the Azure portal). I have to use the option "HTTPS" but you may or may not.
Once the account is in the explorer, on the left pane you should see the new container you created in the earlier step. Click on it which should pull up your bacpac file in the middle pane.
Highlight the bacpac file and choose download.
It's a bit of a pain because you have to install the explorer utility but after that's done, it's really easy.
Let me know if this works.

How to import mysql sql file into microsoft visio 2007?

Does anyone know how to import a mysql sql file into microsoft visio 2007, and then generate a database chart automatically?
Thanks a lot.
I have solved it.
I just create database in mysql with sql file, and then i use reverse engineering to build a visio chart.
the link will be useful for that. here
[EDIT]: Add The content of the post.
1.Download the latest MySQL ODBC connector from MySQL site. You may find it here http://dev.mysql.com/downloads/connector/odbc/5.1.html.
After downloading install the connector.
Now open Microsoft Visio and open Database Model Diagram template (you may find it under Software and Database group).
From Database menu click on Reverse Engineer. You will see the Reverse Engineer wizard.
Click on the New button.
Select System Data Source.
Click Next.
Select MySQL ODBC driver from the list.
Click Next and then Finish. MySQL Connector/ODBC Data Source Configuration window will open.
Give a name to the datasouce, database server host, user name, password and select the database you want to reverse engineer. Remember, the list of database will be shown if you have provided correct information.
Click on Ok. Now you will find the data source in Data Source list.
Select the newly created data source and click Next. The regular wizard for reverse engineering will start.
Thanks.