Dropping Database On Another Server Instance

Oct 2, 2015

I have managed to successfully connect to another SQL Server instance using a linked server.

I can then do my select statement like this: select * from [servernameinstancename].[databasename].[databaseowner].[tablename]

I just wanted to know how I can drop the database on the other instance?I have tried doing: DROP DATABASE [servernameinstancename].[databasename].

View 3 Replies


ADVERTISEMENT

How To Move A Single Database From SQL Server Instance To New SQL Instance

Jan 13, 2007

Hi,

I want to move one database from the source SQL Server 2000 instance to a new SQL 2000 instance in another machine. I have five user databases in this source SQL instance. How should be my approach to move this single database out of this ? My understanding is restoring this database in the new instance, copying all logins to the new instance and then copying the jobs, DTS packages, alerts, operators only specific to this database will do it. Please let me know if this is exactly what I should do ..

Thanks in advance..

Regards,
Himansu

View 1 Replies View Related

How To Move A Single Database From SQL Server Instance To New SQL Instance

Jan 13, 2007

Hi,

I want to move one database from the source SQL Server 2000 instance to a new SQL 2000 instance in another machine. I have five user databases in this source SQL instance. How should be my approach to move this single database out of this ? My understanding is restoring this database in the new instance, copying all logins to the new instance and then copying the jobs, DTS packages, alerts, operators only specific to this database will do it. Please let me know if this is exactly what I should do ..

Thanks in advance..

Regards,
Himansu

View 4 Replies View Related

SQL Security :: Log Ship Database In Server Instance In One Domain To Database

Jul 2, 2015

I had created 2 Sql server instance in 2 servers created using VMware. From the primary server I log shipped the required databases into the secondary. Both the servers were in the same domain whose active directory was also in another server in the same virtual lab environment. My question can we have the primary sql server in one domain and the secondary sql server to which the logs are shipped in another domain by including a router also between the 2 networks for connectivity?

View 6 Replies View Related

Dropping Database

Dec 21, 1998

Hi,

After I drop the database, I backed up the master database, I recreate the database with new name. When I tried to do the import on the command level,
It gives me the error:
Attempt to locate entry in the sysdatabases for database 'db1' by name,
failed -- no entry found in that name.

What should I do? Thanks.

View 1 Replies View Related

Dropping Database

Sep 7, 2007

Hi friends,

How I can drop a database insatance from a different server ( data base is SQL Server 2005) from my code

Hoping a early reply ....
Thanks :)

View 5 Replies View Related

Dropping A Database From ASP.NET

Jan 16, 2008

I am trying to run a dymanic DROP DATABASE <dbname> command in a stored procedure called from ASP.NET. I typically connect from the .net using a SQL builtin account. I am getting this error:

System.Data.SqlClient.SqlException: Cannot drop the database 'db_testco', because it does not exist or you do not have permission.

The database is there for sure asI can browse it via the Studio manager. What permission do I need to set for my .net login to allow it to drop ? I tried adding the Delete permission to the database and still no go...

Setup: SQL 2005 SP2 2 Node cluster.

Thanks.

View 3 Replies View Related

Dropping Distribution Database

May 2, 2000

i would like to drop a distribution database after disabling both susbscriber and publisher .but i get a message saying distribution database is still in use .and as far as i can tell its there is no one using it .also stopped sql agent but no luck . and when i do select @@ servername i get servername is null how do i correct it .

thanks

View 1 Replies View Related

Dropping Users In Database

Dec 23, 1999

Is there a way in SQL to drop any users from a database. I am trying to schedule some nightly DB maintenance and some users are still in there sometimes. I need to be able to kick the out to do dbcc checkdbs, etc. Is there a way for me to do this without stopping the SQL services?

View 3 Replies View Related

Problem Dropping Database C#

Apr 26, 2006

Hi,

i have a problem dropping a database?

I have a WinForm and i can create DB, create the Tables and drop the DB via buttons.

When i start myProgram it's no problem to drop the Database.
Then i can create the database without problems.
The tables also without problems.

Now if i try to drop my whole DB, i get the error message:

SqlException Handle :System.Data.SqlClient.SqlException: Cannot drop database "XtmsDb" because it is currently in use.


The code for dropping db:

public void deleteProjectDB()
{
conn.ConnectionString = "Data Source=TURM21;Initial Catalog=master;Integrated Security=SSPI;";

sqlStr = "Drop database XTmsDB";

try
{
System.Console.WriteLine("Opening Connection...");
conn.Open();
System.Console.WriteLine("Connection opened!!!");

SqlCommand cmd = new SqlCommand(sqlStr, conn);
cmd.ExecuteNonQuery();
System.Console.WriteLine("Database dropped!!!");
}
catch (SqlException dropEx)
{
System.Console.WriteLine("SqlException Handle :{0}", dropEx.ToString());
}
finally
{
conn.Close();
System.Console.WriteLine("Connection closed!!!");
}
}


The code for creating db:

public void createProjectDB()
{
conn.ConnectionString = "Data Source=TURM21;Initial Catalog=master;Integrated Security=SSPI;";
sqlStr = projectDBStrings.getDBCreateString();

try
{
System.Console.WriteLine("Opening Connection...");
conn.Open();
System.Console.WriteLine("Connection opened!!!");
SqlCommand cmd = new SqlCommand(sqlStr, conn);
cmd.ExecuteNonQuery();
System.Console.WriteLine("Database created!!!");

}
catch (Exception)
{
System.Console.WriteLine("Could not establish Connection!");
}
finally
{
conn.Close();
System.Console.WriteLine("Connection closed!!!");
}
}

The code for creating Tables:

public void createProjectTables()
{
conn.ConnectionString = "Data Source=TURM21;Initial Catalog=XtmsDb;Integrated Security=SSPI;";
ArrayList createList = projectDBStrings.fillProjectSchema();
SqlTransaction tx;
SqlCommand cmd = new SqlCommand("", conn);
IEnumerator createListEnum = createList.GetEnumerator();

try
{
System.Console.WriteLine("Opening Connection...");
conn.Open();
System.Console.WriteLine("Connection opened!!!");
try
{
while (createListEnum.MoveNext())
{
sqlStr = (String)createListEnum.Current.ToString();
tx = conn.BeginTransaction();

cmd.CommandText = sqlStr;
cmd.Transaction = tx;
cmd.ExecuteNonQuery();

tx.Commit();

}
System.Console.WriteLine("Schema created!!!");

}
catch (SqlException deleteEx)
{
System.Console.WriteLine("SqlException Handle :{0}", deleteEx.ToString());
}
}
catch (SqlException connectionEx)
{
System.Console.WriteLine("SqlConnection Handle : {0}", connectionEx.ToString());
}
finally
{
conn.Close();

System.Console.WriteLine("Connection closed!!!");
}
}



Who can help me?

View 14 Replies View Related

Dropping Connections To Restore Database

Aug 3, 2000

Hello all,

I need to restore my database and I keep getting a database in use error. Can someone tell me the easiest way to drop all connections to a database and open it exclusively?

Also, I'm not sure where this connection is coming from, there is another database on the same machine that has user connected, can these connections be the problem?

Thanks

Kevin Kraus

View 3 Replies View Related

Dropping A Database That Subscribes For Replication

Nov 2, 1999

I am trying to delete a database that currently subscribes for replication. The problem however, is that the publishing server no longer exists and I can't disable the subscription therefore I can't drop the database. When I try to disable the replication the server tries to communicate with the old server. Is there anyway to force the dropping of the database or to force the server to disable replication.

thanks in advance

Michael

View 2 Replies View Related

Dropping All Database Objects Through Script

May 28, 2008

Does anyone have a script that will iterate through a database and drop all objects in order of dependencies? I need a way recreate all objects in database through SQL script in a development environment without having to recreate the actual database. Therefore I need a way to clear out the current database objects first without running into a problem with dependencies. This needs to be dynamic so that if a object is added, it is automatically included in the drop scripts.

View 5 Replies View Related

DB Design :: Dropping And Rebuilding A Database

Jun 26, 2015

With some performance issues faced as I checked on Google came across Paul Randal's article on Logging & Recovery: URL...In this regard, and with some schema changes required, ended up with a decision to drop and re-create a database. What are the proper way to do the same and following queries:

A) What would be the recommended way to shift data from some tables of former database to that of the newer one (The latter ones created with the Script Table transaction)?
B) Would a simple Drop Database completely delete the former database completely and clean up the memory (database pages etc.) or I need to take some additional steps for clearing up the space?
C) Most of the data tables have been updated via loading the Bulk Insert commands time to time from CSV/flat files. Could that be somehow the cause of enlarging the the size of Database and Log?

View 16 Replies View Related

Connection String For Default Instance Of SQL Server 2005, On A Box Also Running A Named Instance Of SQL Server 2000

Nov 15, 2007

The box I am trying to connect to is running two instances of SQL Server.
There is a SQL Server 2005 instance which is the default. There is a SQL Server 2000 instance which is named 'SQLSERVER'.
 I can connect to the SQL Server 2000 instance no problem:<add key="ConnectionString" value="server=MYPCSQLSERVER;database=mydatabase;user id=****;password=****" />
However,  I am having trouble connecting to the Default SQL Server 2005 instance. I have tried:
<add key="ConnectionString" value="server=MYPC;database=mydatabase;user id=****;password=****" />
 but it doesn't work. I have tried explicitly setting SQL Server 2005 to use port 1434 (as SQL Server 2000 is running on port 1433), and then used:
<add key="ConnectionString" value="server=MYPC,1434;database=mydatabase;user id=****;password=****" />
but this doesn't work either.
 
Am I mssing something here? Any help much appreciated
Thanks...
 

View 2 Replies View Related

Dropping An Active Connection On An Attached Database

Jan 9, 2008

Why in the hell doesn't SQL Server provide a facility for dropping anactive connection on an attached database in SQL Server Managementconsole? I can't detach an attached database because apparently thereis an active connection.I know you can use SSEUTIL but it seems like kluge for a poorlythought out function.Crazy

View 2 Replies View Related

Do I Need To Create A Domain To Get Connectivity To A Report Server Database On A Remote SQL Server Instance?

Oct 23, 2007

I'm setting up a simple SSRS implementation for a non-profit organization, using two servers hosted at a data center. The first server has SQL Server Standard Edition and Reporting Services installed. I've designed and deployed a number of useful reports on this server.

I was hoping to isolate this first server by installing IIS and SSRS on the second server, have users browse from the Internet to that second server (over SSL, of course), and have all reports served up from databases (and, presumably, the report server database) on the first server.

During the installation of SSRS on the second server, however, I'm being prompted to specify the service account. According to the help text:



"Reporting Services. Service accounts are used to configure a report server database connection. Choose a domain user account if you want to connect to a report server database on a remote SQL Server instance. If you are using a local report server database, you can use a domain user account or Local System to run the service."

I believe I want to configure SSRS to connect to a report server database on a remote SQL Server instance; therefore, it appears that I need to enter a domain user account. The only problem is, neither server belongs to a domain; they are members of a simple two-server workgroup.

Does SSRS, configured to connect to a report server database on a remote SQL Server instance, require a domain? Does what I'm hoping to accomplish require a domain? Creating a two-server domain seems like overkill for this implementation, doesn't it?

I appreciate any comments and suggestions. Thanks!

View 1 Replies View Related

Forcing A Server To Be Removed From A Reporting Server Database Instance

May 23, 2008



I have a database that was migrated from a SQL Server 2000 installation. The database was a remote server (call it ServerA) from the Reporting Services install (call that one ServerB). Both of the original servers can effectively be called dead at this point, and I want to redeploy both to a SQL Server 2005 installation (ServerC). RS is already installed on the new box, but is not initialized to any database. The SQL Server 2000 based database (from ServerA) has been restored and upgraded to 2005. The keys from the original RS host box (ServerB) have been successfully restored to the new server (ServerC). Unfortunately, the new server still sees the configuration of ServerB in the database, and thinks that I'm trying to do a scale out deployment. How can I force ServerB to be kicked out of the installation so that ServerC can properly take over?

TIA,

View 1 Replies View Related

How Can We Create New SQL SERVER 2005 Database Instance

Feb 5, 2008

In my machine , we were used befour sql server2000 and now we are using sql server 2005 ,
So, I have both 2000 and 2005 installed on my machine ,
on my machine i am working on Custome Paging and one function ROW_NUMBER() is not working ,because of i think i am still working on 2000 instance on locally,
Can any one know how can we create an instance of sqlserver 2005 database and work with that?
I want to work with sql server 2005.

View 1 Replies View Related

Reducing Database Size After Dropping Text Column

Jul 20, 2005

Hello,A while back I dropped a text column from a SQL Server 7 databaseroughly 3GB in size. I expected the size of the database to decreaseby around 1GB, but no change occurred. After searching usenet, Idiscovered that SQL Server 7 has no way of reclaiming that space, butthat there is some command that can be run in SQL Server 2000 thatwill reclaim it.I have since migrated this database to SQL Server 2000, and am nowtrying to figure out what that command is, but cannot locate anyusenet posts about it... also tried searching books online, but can'tfind anything that way either.Does anyone know what I should run?Thanks,Tom

View 6 Replies View Related

Transact SQL :: Database Size Does Not Decrease After Dropping All The Tables

Oct 15, 2015

I have a database consisting of two main tables and 12 sub tables.

This was leading to increase in database size. So we thought of storing the sub tables data in the main tables in form of xml  in a column of varchar(2000) type.

So we created a new database that only had 2 tables and we stored the data of the sub tables in the new column of the main table.

Surprisingly we saw that the database size increased rather than decreasing .

View 9 Replies View Related

SQL 2012 :: Copying A Database To Another Server Instance Options

Jun 25, 2014

We have SQL Server 2012 running on Windows 2008 Server. We need to copy five databases from our 'sandbox' to our test server and then to our production server. The database backup file sizes are 3 MB, 20 MB, 344 MB, 645 MB and 17 GB. We are planning on using the backup and restore method since we already have full backups and the scripts to recreate the logins/users/permissions. We believe this method provides more flexibility and control over the process. However, we have a few jobs, maintenance plans and ssis packages.

To get the jobs to the new server instance, the plan is to script out the jobs on the 'sandbox' and execute the scripts on the test server instance. Is this the best or only way to handle the jobs?How to get these maintenance plans to the new server instance? (There is no 'script out' maintenance plan option.) We may have to just recreate them on the new server instance. Is this the best or only way to handle the maintenance plans?

We have a few ssis packages. How to handle getting the ssis packages over to the new server instance (using the backup restore method)? These packages use the Project Deployment Model. Therefore, should we restore the SSISDB or open up the package file using VSS on the new server instance and change the connection information to point to the new server instance.

Just wondering if there is any reason or advantage to use the Detach and Attach method or Copy Database Wizard method? I have read where the Copy Database Wizard method handles the database's dependent objects like logins, jobs, maintenance plans, user-defined error messages and shared objects from the master database. Are there any other move/copy database methods to consider? Just trying to make sure we have thought out everything and are using the best method to copy our databases over to another server instance.

View 3 Replies View Related

Attaching A SQL Express Database To SQL Server Standard Instance...

Oct 18, 2006

If I create a database in SQL Express and then copy the MDF/LDF files and attach them to a machine running SQL Server 2005 Standard - will this new database have SQL Express limitations?

Are there good reasons not to do this and create the database in SQL Server Standard using scripts generated from the SQL Express instance instead?

Basically, I'm setting up a merge replication between Standard and SQL Express for a common database and I figure attaching a copy of the database created in SQL Express is the fastest way to get this started.

View 3 Replies View Related

Detach Database File From Local SQL Server Express Instance By C#?

Jan 30, 2008

I am using the following C# code to establish a SQL connect to a SQL database file:

// connection string
// attach a SQL database file to a local SQL server express instance
string _connectionString = @"Server=.SQLExpress; AttachDbFilename=C:BalanceDatabase_1.mdf; Trusted_Connection=Yes; User Instance=True";

// using System.Data.SqlClient;
SqlConnection _sqlConnection = new SqlConnection(_connectionString);
// open the connection
_sqlConnection.Open();

// do something

// close the connection
_sqlConnection.Close();

So far, the connection works fine.

However, next, I want to copy the database file to another folder. So the following codes:
// source database file name
string sourceDatabaseFileName = @"C:BalanceDatabase_1.mdf";
// target database file name
string targetDatabaseFileName = @"D:BalanceDatabase_1.mdf";
// copy database file
System.IO.File.Copy(sourceDatabaseFileName, targetDatabaseFileName, true);

Then the program came with runtime exception: "IOException was unhandled: The process cannot access the file 'C:BalanceDatabase_1.mdf' because it is being used by another process."


Is it because the database file was sill attached to the local SQL Server express instance? What can I do to bypass this problem? Detach the database file? or dispose the local SQL Server express instance?

Many thanks indeed!

View 9 Replies View Related

SQL Server Admin 2014 :: Cannot Connect To Named Instance (2nd Instance) From Local SSMS

Jul 22, 2015

I've two instances(Default, Named[dynamicsFINANCE]) running on SQL server 2014. However, when I try to connect to named instance say (dynamicsFINANCE) using SQL authentication from local SSMS, I get below error message:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

I assigned a static port number to the named instance [dynamicsFINANCE] 1450. I also setup the firewall rule to allow access to Port 1450.

View 5 Replies View Related

SQL 2012 :: Clustered SSAS Unable To Connect To Named Instance (instance Not Found On Server)

Mar 20, 2014

I have a 3 node cluster on which I have installed SSAS as it's own insntance. I have created this as a named instance and can connect to it by serverinstance if I'm on the server itself. However from my desktop I get the error saying instance was not found on server name.

I have defined an alternate port and setup firewall rules and can connect via server:port but not serverinstance. Prior to making this change SSAS was running on default port of 2383 and I could connect just by servername.

I have read many articles for previous versions saying that clustered SSAS will always use 2383 and that you must connect just using servername. However and this is were it gets strange. I have a 2 node UAT cluster with SSAS setup exactly the same way I've described above and I can connect from my desktop as serverinstance.

Should I be able to connect as serverinstances for a named clustered instance in 2012 ?

View 4 Replies View Related

How SQL Server2000 Client Instance And Server Instance Works?

Sep 12, 2006

Hi all,

i have installed SQL client instance on my Desktop "Machine-A", and i used to connect to SQLServer2000 running on another "Machine-B" by using valid username and password.

i created a DTS package and i used to run it. im very confused how the communication happens between the two machines and which process run where and which initiates which and which machine allocates waht resources. im really interested to know all these things. if any one know plz help me out.

Thanks in advance.

View 1 Replies View Related

Communications To The Remote Server Instance Failed Before Database Mirroring Was Fully Started

May 12, 2006

command in principal server

ALTER DATABASE database name

SET PARTNER = 'TCP://<mirror_server_name>:5022'

return:

Msg 1413, Level 16, State 1, Line 1

Communications to the remote server instance 'TCP://<mirror_server_neme>:5022' failed before database mirroring was fully started. The ALTER DATABASE command failed. Retry the command when the remote database is started.

This problem is only in production database any testing database include adventureworks mirroring sucessfuly. Why is problem:?

size? database > 9GB

slow HW? Principal database Intel D 3Ghz,4GB RAM, 4x 15k RPM HDD RAID 5 / Mirror database 2x Xeon 3Ghz,4GB RAM,6x HDD 10k RPM RAID 10

Slow LAN? both servers connect 1Gb/s

please help me

THX

View 17 Replies View Related

Dropping SQL Server Connections

Jul 17, 2001

I am using Access 2000 to link tables from SQL Server. The tables are linked using ODBC DSN`s. I am running a query to return some rows to Access, but once I have returned the rows, I want to drop the linked table connection to SQL Server, because it is locking a table on the server. I think I need to write a bit of VBA code, but I don`t know where to start. Any ideas would be greatly appreciated. Thanks.

View 1 Replies View Related

MS SQL Server 7 Dropping Indexes

Mar 2, 2000

Hi
Has anyone heard of MS SQL Server 7 dropping indexes?
I had created an index on a table. The next day
the index had disappeared. Has anyone expirienced such
a problem?

Thanks in advance

Winston

View 1 Replies View Related

Dropping Current Server Registration In SQL 6.5

Oct 1, 1999

Are there any issues with dropping registration of a SQL 6.5 database and then registering it again. I think this is what I am going to have to do because a consultant we are using decided to change the security from standard to Integrated. Now we are getting the following error when we are in the SQL Enterprise Manager and trying to open TAP:

A connection could not be established to TAP[SQL Server]Login failed:Reason:Not associated with trusted SQL Server connection.

Thanks for any help

View 1 Replies View Related

Dropping The Indexes On Production Server

Jun 24, 2008

Dear All,
i'm planning to drop all the non clustered indexes (as they are not congigured well) on production database, and run the latest script to create fresh non clustered indexes on specific columns.

now my doubts are
1)will the replication affect with dropping and recreating of indexes?
2)query to drop all the non clustered indexes on that database....
can i use the query delete from sysindexes where indid>1
will the query works for me to drop all the non clustered indexes?
3)is it necessary to generate a snapshot again after creating the new indexes? or can i drop and run at subscriber also?

please guide me in this regard




Arnav
Even you learn 1%, Learn it with 100% confidence.

View 3 Replies View Related

How Do You Code The Dropping Of A Linked Server Def?

Nov 8, 2007



There are procs to add linked servers, and procs to add and delete linkedserver logins, but I dont see a proc to delete the actual linked server definition. And yet EM will drop the definition of a linked server. So the obvious question is "How do you code the dropping of a linked server?

Thanks!

Michael

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved