Mirroring of database on same server for tersting - database

Is possible to mirror to database of same sql server . My server instance is SQLSERVER having 2 database with same structure but with differ name . i want db1 to sync with db2, so if i want user to test application i can do it.

Even though I would not recommend having them on the same sql server (performance/security wise), just have a look here: http://technet.microsoft.com/en-us/library/dd207006.aspx
(since you said SQLSERVER, I guess you meant mssql)

Related

Present databases on 2 SQL Servers like they are all on 1

I have 2 SQL Servers, with several different databases on each. I want to present them as a single SQL Server showing all of the databases on either Sql Server.
We have yearly archive databases, so 1 database for each year. This year we decided to deploy a new SQL Server that will host newer years, so older yearly databases are on the old server, and future will be on new one.
I know I can link the servers, but I am not sure if I can do it in the transparent way so that no application has to change the query - so far I always had to use linked server explicitly in each query that uses it.
TLDR: I want to access databases on another SQL Server via main SQL Server so that app doesn't know or care about SQL Server details and don't need to have if (Year > 2021) {then use this server } else {use that server} type of logic and can behave like all databases live on the same server.
You can follow the below steps:
Create a linked server pointing to older server
Create an Empty Database in the new server, corresponding to older database in the older server.
Create synonym for each object in the older database in the Empty database
Now, When you refer to synonyms in the empty database, it will appear as if the older database resides in the new server.

Link SQL-Server tables to MS Access file

In my SQL Server database I need to mantain the tables linked and in sync with the tables of an MS Access .mdb file.
Lets say I update something or add something in the MS Access database via my own application.
I want those changes reflected in the SQL Server database.
I need a way to push the updates to the SQL Server database, or a way to update the SQL Server database with the new data when I connecto to it.
Trying to be clear: source must be the .mdb file database and destination must be the SQL server database. I need to keep them in sync.
Both databases have the same tables.
I have read a lot of posts, even this one: From SQL Server how do I read from an MS Access database to UPDATE data in one or more table columns? that seems to be the solution, but I can figure out the steps.
The official tool for this is:
SQL Server Migration Assistant for Access (AccessToSQL)
It has a migration feature that, when run, will replicate (adjust) the table schema in the database in SQL Server to match that of the Access database.

How to create Contained Database in sql server 2102

plz give me detail of Contained Database = true in Sql Server 2012
how to use and why ?
How to Migrate to a Partially Contained Database:
USE [master]
GO
ALTER DATABASE [Accounting] SET CONTAINMENT = PARTIAL
GO
What are Contained Databases in SQL Server 2012:
A contained database is a database that is isolated from other
databases and from the instance of SQL Server that hosts the database.
SQL Server 2012 helps user to isolate their database from the instance
in 4 ways.
Much of the metadata that describes a database is maintained in the database. (In addition to, or instead of, maintaining metadata in
the master database.)
All metadata are defined using the same collation.
User authentication can be performed by the database, reducing the databases dependency on the logins of the instance of SQL Server.
The SQL Server environment (DMV's, XEvents, etc.) reports and can act upon containment information.

Compare SQL Server Database Schema with Oracle Database Schema

in my development environment we support the application both on MSSQL Server as well as Oracle. The database schema of both of these RDBMS are same.
while development we found that the developer made a mistake and forgot to change the oracle database for the last 1 yr. therfore the oracle script is quite behind in term of schema from SQL Server schema script.
now the question is how i can compare the two RDBMS systems to find the difference and make the oracle script updated
If there are no track log from which it's possible to find and reproduce all changes applied to SQL Server since first detected inconsistency with Oracle version, or that changes was applied, but only partially, you really need to compare objects presented in both databases.
In this case setup a link between databases on any side and use system dictionary views to compare table structures and other objects to find differences and, possible, to generate script for Oracle scheme rollup.
If you want to act from MS SQL Server side:
Install and configure Oracle Instant Client
Install Oracle ODAC
Follow Microsoft recomendations (64-bit version)
Connect as any user with dba role (or use same Oracle schema where object resides) to Oracle from MS SQL database
If you want to act from Oracle Server side:
Install and configure Oracle Database Gateway for SQL Server.
Create database link to MS SQL Server.
After successful configuration you may join Information schema views on SQL Server side with Data dictionary views on Oracle side to find differences.
Of course there are many troubles at this way like different data types, but it gives a chance to automate at least part of work.

Insert rows into a SQL Server table from Oracle

I have an Oracle 10G database running on a Unix environmnent and have a requirement to write a PL/SQL job that will be running on the Oracle database that will populate tables in another database which is a microsoft SQL Server database running on a Windows platform.
Having looked around, it looks like this is possible via database links. Has anyone got any more information on this? For example how reliable is the connection and are there any disadvantages in having such a setup?
Chances are that i would have limited access to the SQL Server database. Is the above possible without having to make any changes to the SQL server database? (Assuming the DBA on the SQL server has configured the database to be accessed from other databases)
Thanks
Use the Oracle feature DG4ODBC, it is as reliable as any normal DBLINK setup, to the SQL Server side it will look like any other sort of client connection. You only need to do anything more elaborate if you are planning to do distributed transactions between Oracle and SQL Server (i.e. 2 Phase Commit). You will probably also want UnixODBC and FreeTDS.

Resources