Copy database to the local machine - ORACLE - sql

I need to copy the entire database (Shema, object, data) from the server to my local machine for testing purposes. I know that there should be development database on the server, but I need to have another copy on my machine. The database is 11g and I am using SQL developer. I only found this tutorial. However, I think it creates another copy on the server and does not transfer it to the local machine. Any help is deeply appreciated.

You need to have installed ORACLE database server on your local machine first.
Then you can use exp/imp or expdp/impdp utilities for copying entire database or schema/user.
For example how to use data pump (expdb) see this section in Oracle documentation.

you can use the exp/imp utility
exp userid=user/pass#prod full=y file=full.dump
imp userid=user/pass#dev full=y file=full.dump
datapump is running server side and is faster but then you would have to access the file system to get the dump. If you have access to the server it's the same command just impdp`expdp` running from the host.

Related

Replication for local and global databases

I have a server which is running a large database. Many computers and laptops will connect to my server and download this large database to run in localhost. They will create, modify or delete this local database. When everything is done, these databases need to be synchronized to the main database on the server.
I am using PostgreSQL, by the way.
Here I come up with a solution using replication. rubyrep is my choice. However, rubyrep requires every local database to have a global IP. I cannot find a way for my server to connect to those local databases. How can I solve that problem?

VB.NET Creating a local database in VS2013 or in SQL Server Management Studio

I am about to begin a personal project to build my skills in the .net environment. I am familiar with SQL Server Management Studio and how to create a database in it but I discovered how to make a local database in Visual Studio as well. My program is only going to require local database access as it will be used for individual inventory systems rather than connected ones. Am I ok to use the onboard tools in visual studio and create a local databasse or should I be using the SQL Server Management Studio?
When you use the Local Database item template in VS, it creates a SQL Server CE data file (SDF) and adds it to your project. When you use the Service-based Database item templete, it creates a SQL Server (Express) data file (MDF) and adds it to your project.
The advantage of using the VS tools is that the data file becomes part of your project and can therefore be easily deployed with the compiled application. As such, the database is basically part of the application.
If you choose SQL Server CE then you don't need a server installed on the user's local machine. They can install SQL Server CE or you can install it with your app if you want, but you also have the option of simply deploying a DLL with your app and it will work.
If you choose SQL Server Express then the user actually needs a SQL Server instance installed on their machine. To be honest, I'm not 100% sure whether that instance must be SQL Server Express or it can be a full SQL Server instance too. It would usually be SQL Server Express though, which you can install and even download automatically when you install your app, depending on the deployment method you choose.
If you use the VS tools to create an MDF data file then your connection string will contain the Data Source and AttachDbFilename attributes. The Data Source will generally be ".\SQLExpress", i.e. an instance named "SQLExpress" on the local machine. That instance name is not required, although it is the default for SQL Server Express, but it must be on the local machine. The MDF file gets attached at run time and detached again when you're app is done with it. It will also usually be attached to a user instance, which means that other users can't see it, even when it's attached. Note that, in later versions, the LocalDB feature of SQL Server may also be utilised.
If you create your database in Management Studio then it's not actually part of your app. It will be permanently attached to the SQL Server instance so, everyone will be able to see it and open it, assuming permissions allow. Creating the database during deployment will be an extra step in that case. You might create a backup and restore that during deployment or generate SQL scripts that get run. In this case, your connection string will contain the Initial Catalog attribute to specify the name of database to connect to, as well as the Data Source attribute. This option is required if you want multiple clients to be able to connect to the database.
In short, if you are only going to be accessing a database from the local instance of the one application then creating a database in VS is OK and probably a good idea. Whether you choose SQL Server CE or SQL Server Express may well depend on what level of functionality you need.

Export SQL database (all tables) from remote server

I'm current using a 3rd party product, which uses an SQL Server database. I've been asked to take a copy of the database for our own backup/security purposes, but I'm having trouble.
To access the database I'm currently logging into one of my companies servers using remote desktop, where SQL Server 2005 Express is installed. Using that instance of SQL Server I then connect to the 3rd party's SQL server.
when I execute Tasks -> Back Up..., it appears to work, but the files are stored locally on the remote SQL Databases server, which my IT teams tells me is expected.
I tried using Tasks -> Generate Scripts... but the option to "Script Data" isn't available, either because it's SQL Server 2005 Express, or because the database is remote (not sure which, but probably one of those).
I've tried other things that I can't recall at the moment, and I'm out of ideas.
Can anyone suggest something that will let me get a 'local' copy of the remote databases table structure AND data?
The Generate Scripts wizard is unavailable because you are using a very old version of Management Studio Express. The 2012 version will work just fine against 2005 instances, but there is no longer an Express edition anyway, because all of the SSMS features are now available without any license.
Download the latest versions here:
https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms
I list downloads for the older versions at the bottom of this post:
https://blogs.sentryone.com/team-posts/latest-builds-management-studio/
Backups do generate locally. That is to be expected, as your team has already told you. You can generate it locally and then download it with a tool such as an FTP client. I highly recommend Redgate tools. See http://www.red-gate.com/products/dba/sql-backup/ It's a great tool and has some network backup options built in to ship your backups elsewhere. If it's a one-time thing, Redgate also has tools for that too, e.g. SQL Compare and SQL Data Compare.
The solution you pick really depends on how frequently you have to run and download backups locally and how big the DB is.

Syncing database client server in VB 2010

I'm creating a VB2010 application which will require a connection to MSSQL. Should I Install SQL 2008 on my computer then use MS SQL 2008 as my data source or skip installing SQL 2008 and use MDF instead?
Also the program must have the following requirement
Program must use SQL as their database source
End user must not install SQL server on their machine
Program must be able to update (sync) the local SQL database from SQL server on the web. (User will have option to delete everything on their local database and load everything fresh from the server or to merge the update with existing data)
Programs will (most of the time) run in an offline environment. When the user have access to internet they can update the database
The program must allow user to add,edit, delete their local database while offline
Only certain user (authorized user) can update their local database back to the serverC
Is it possible to created a program that meets all the above requirement ?
If yes, can you please clarify on how can I accomplish all points
Thank you very much
use MDF instead?
An MDF file is Sql Server.
End user must not install SQL server on their machine
and
Program must be able to update (sync) the local SQL database from SQL server on the web.
In that case, I recommend Sql Server Compact Edition. It is upgrade compatible to full Sql Server, which will make sync operations easier, but it does not require you to install the full Sql Server engine to the local system.

How to automatically backup a SQL Server database on my ISP's location from my own pc?

I have very limited access to the SQL Server at my ISP.
I have a very simple tool to create databases and execute SQL (which is enough most of the time) but now I also want to backup (and in the case of an accident, restore) a database from my own PC (or via a web application, if that's possible, both are ok)
Is there a tool which can do that auotmatically?
It's a SQL Server 2008 database.
I guess I can do it from my SQL Server Management Studio, but I'd prefer a tool that can do it scheduled.
Kind regards,
Michel
You can only backup (and restore) your database from local drives on the SQL Server machine - e.g. the machine at your ISP's location.
You cannot backup SQL Server and store the *.bak file on your local system, over the internet.
So what you need to do is create some kind of a process that stores the BAK file on the server machine at your ISP's location, and then copies or moves it to your home machine. For that, you need to have write access to some physical drive at your ISP on their SQL Server.