Thursday, March 8, 2012
adding new objects to sql server
Saturday, February 25, 2012
Adding indexes to tables
Once the transfer is complete I want to add all the indexes on each table in the original db. How would i do that?Why don't you transfer the entire tables, with indexes, and then add your columns?
blindman|||Originally posted by blindman
Why don't you transfer the entire tables, with indexes, and then add your columns?
blindman
Because the indexes i want to add must include the columns i'm adding.|||Originally posted by vmlal
Once the transfer is complete I want to add all the indexes on each table in the original db. How would i do that?
Well then your statement isn't true..they're new indexes and yo need to build them...create a sql script modify them and run...
don't know of an automated way...|||How can the indexes from the tables in the original DB include the columns you are adding? That makes no sense.
You are going to need to write a script that adds whatever indexes you want, and then run the script after you modify your unindexed tables.
blindman|||Yeah i have to add new indexes incl the new columns but all the other indexes excl. the new columns need to be added. i have a scripts to add the new indexes.
Sum of the existing indexes have to be dropped before the new indexes can be added. But is there a way to aleast get the old indexes back?|||If you can come up with a logical way to tell SQL Server what indexes you want to keep and what indexes you don't, then you MAY be able to do this programmatically. Otherwise, SQL Server doesn't have a clue what you want to do.
Write a script. It is the best way to handle this.
blindman
Sunday, February 19, 2012
Adding datafile breaks my log shipping process
I am on sql server 2005. I have a production database that i log ship to another server and keep a standby copy of that database. Transaction logs are backed up every 15 minutes on the production database then copied to the standby server and then applied in order to the read-only standby database.
Every month we add a new partition and datafile to the production database. This causes the log shipping process to break because the read-only standby database doesn't have the new datafile present. I had hoped that the alter database command to create the datafile would be logshipped. It forces me to do a full db restore every month which is a major pain.
Has anyone encountered a similiar scenario? How can I 'log ship' the addition of a datafile every month and avoid doing a full restore of my standby db?
I should add that this is a home grown log ship process, we aren't using the sql server built-in log shipping. Here is a typical backup transaction log script that i'm using:
-- using sql litespeed
exec master..xp_backup_log @.database='dbname,
@.filename='d:\dbbackups\dbname_txlog_<uniqueidentifier>.bak', @.init=1
Any help would be greatly appreciated.
<!--[endif]--> Log shipping cannot handle database file operation, eg. adding new database files. Same operation must be done manually in standby database. <!--[endif]-->
In database mirroring these operations will be handled automatically.
Sunday, February 12, 2012
Adding another server instance to another hard drive?
another hard drive. I'm trying to guard against a hard drive crash.
Currently, I detach, file copy to another drive, then reattach each
individual database. Since SQL Server is running on different hard drive
from the data, I know that I wouldn't have to reinstall it.
1) Is there a way to do what I am asking?
2) Is this the correct the newsgroup to post these questions?
3) Is there a book that covers this?
Tried various keywords, but couldn't find anything in Books Online. I'm
running MS SQL Server Developer's ed. under Windows 2000 Pro.
Niels
That is what backups are for. It's much easier to simply do a backup of
each database (including Master & MSDB) and store those in a different
location. Preferably on a different machine or medium altogether, You don't
have to take the databases off line for a backup like you do with detach.
You might want to take a look at this:
http://www.microsoft.com/technet/pro...n/sqlops0.mspx
Andrew J. Kelly
SQL Server MVP
"Niels" <nkistrup@.comcast.net> wrote in message
news:6v-dnY1yOZGJGCXdRVn2sQ@.giganews.com...
> Problem: For safety reasons, I want an exact copy of all SQL databases on
> another hard drive. I'm trying to guard against a hard drive crash.
> Currently, I detach, file copy to another drive, then reattach each
> individual database. Since SQL Server is running on different hard drive
> from the data, I know that I wouldn't have to reinstall it.
> 1) Is there a way to do what I am asking?
> 2) Is this the correct the newsgroup to post these questions?
> 3) Is there a book that covers this?
> Tried various keywords, but couldn't find anything in Books Online. I'm
> running MS SQL Server Developer's ed. under Windows 2000 Pro.
> Niels
>
|||Thanks Andrew,
But I will still like to create another server. Where I can find the steps
to add additional server instances?
Niels
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:ev$827XREHA.568@.TK2MSFTNGP12.phx.gbl...
> That is what backups are for. It's much easier to simply do a backup of
> each database (including Master & MSDB) and store those in a different
> location. Preferably on a different machine or medium altogether, You
don't
> have to take the databases off line for a backup like you do with detach.
> You might want to take a look at this:
>
http://www.microsoft.com/technet/pro...n/sqlops0.mspx[vbcol=seagreen]
> --
> Andrew J. Kelly
> SQL Server MVP
>
> "Niels" <nkistrup@.comcast.net> wrote in message
> news:6v-dnY1yOZGJGCXdRVn2sQ@.giganews.com...
on[vbcol=seagreen]
drive
>
|||There a couple of options that you might want to consider.
Firstly if your running NT 4, 2000 or 2003, then ask your network guys to
raid the disks, I wouldn't do into it in too much detail but there are
plenty of examples. What a raid does in automatically (non SQL Server) copy
stuff from one hard drive to another.
If you wish to create another instance on your current machine then that
will not really help as if the machine goes then both instances go.
If you want to create another server then you will need another machine to
do it then you just install SQL Server the normal way, that will create a
default instance on that machine.
If you want to keep your database running in case of server crashes then
create a new server and backup your databases on the other server.(using the
backup database command).
If you want a server to kick in automatically when your existing server dies
then look on Microsoft for Replication, and High Availabity Server.
"Niels" <nkistrup@.comcast.net> wrote in message
news:8fKdnfr3UYxtyCTdRVn2sw@.giganews.com...
> Thanks Andrew,
> But I will still like to create another server. Where I can find the
steps[vbcol=seagreen]
> to add additional server instances?
> Niels
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:ev$827XREHA.568@.TK2MSFTNGP12.phx.gbl...
> don't
detach.
>
http://www.microsoft.com/technet/pro...n/sqlops0.mspx[vbcol=seagreen]
[vbcol=seagreen]
> on
> drive
I'm
>
|||Peter,
So much for my mastery of English. I don't think I'm explaining the
situation correctly, sorry.
I'm running Win 2000 Pro, with the developer's edition of MS SQL Server, but
I have 4 hard drives ... and it's all on my home computer (I'm the 'network
guy'). Maybe another server instance is not the correct terminology?
Currently my data is on D:, but I would like to use one of the other hard
drives to actively store data.
If the computer crashes, I'm screwed, but I can always move the hard drive
to another machine. Heck the drive where the data is 6 1/2 yrs old, and has
migrated across machines in the past. (The hard drive.)
Niels
"Peter Nolan" <peter.nolan90@.ntlworld.com> wrote in message
news:x4luc.65$PA4.57@.newsfe1-gui.server.ntli.net...
> There a couple of options that you might want to consider.
> Firstly if your running NT 4, 2000 or 2003, then ask your network guys to
> raid the disks, I wouldn't do into it in too much detail but there are
> plenty of examples. What a raid does in automatically (non SQL Server)
copy
> stuff from one hard drive to another.
> If you wish to create another instance on your current machine then that
> will not really help as if the machine goes then both instances go.
> If you want to create another server then you will need another machine to
> do it then you just install SQL Server the normal way, that will create a
> default instance on that machine.
> If you want to keep your database running in case of server crashes then
> create a new server and backup your databases on the other server.(using
the
> backup database command).
> If you want a server to kick in automatically when your existing server
dies[vbcol=seagreen]
> then look on Microsoft for Replication, and High Availabity Server.
>
> "Niels" <nkistrup@.comcast.net> wrote in message
> news:8fKdnfr3UYxtyCTdRVn2sw@.giganews.com...
> steps
of
> detach.
>
http://www.microsoft.com/technet/pro...n/sqlops0.mspx[vbcol=seagreen]
databases
> I'm
>
|||A disaster recovery plan will help you minimize data loss. You need to
plan for various recovery scenarios according to the amount of data loss
that is acceptable to you.
The worst case is that you lose your computer completely due to a disaster
such as for or theft. Your only recourse in this situation is to reinstall
SQL Server on a working machine and restore from backups you've kept in a
safe location.
If your computer crashes and/or you lose your SQL Server drive, you might
get lucky with a successful attach of the database files if your database
files are intact. However, you should not rely on this and plan on
restoring your database from backup because you might not be able to attach
databases which were not detached properly.
The bottom line is that you need to backup your databases periodically and
archive the backup files to a safe location.
Hope this helps.
Dan Guzman
SQL Server MVP
"Niels" <nkistrup@.comcast.net> wrote in message
news:NeudnYnNW-kXTiTdRVn2tQ@.giganews.com...
> Peter,
> So much for my mastery of English. I don't think I'm explaining the
> situation correctly, sorry.
> I'm running Win 2000 Pro, with the developer's edition of MS SQL Server,
but
> I have 4 hard drives ... and it's all on my home computer (I'm the
'network
> guy'). Maybe another server instance is not the correct terminology?
> Currently my data is on D:, but I would like to use one of the other hard
> drives to actively store data.
> If the computer crashes, I'm screwed, but I can always move the hard drive
> to another machine. Heck the drive where the data is 6 1/2 yrs old, and
has
> migrated across machines in the past. (The hard drive.)
> Niels
>
|||Dan,
Lets talk 'preemptive correction'. My data drive is 6 1/2 yrs old & have
the replacement drive ready for swapping. How do you copy the server
instance onto a new drive. From what I can see, it is not as easy as
copying the SQL data folder to another drive, then onto the new one. (Or is
it?)
I am still curious about creating other server instances on other hard
drives. That way, I could spread the data across hard drives. Yes, I need
to transfer my data to a new drive, which will have the same drive. But
just because I cannot figure how out how to create new server instances,
makes me curious about the procedure. I work as a T-SQL developer, but my
DBA skills are minimal, which is why I'm being such a persistent pest about
this.
Hard drive crashes remain my #1 disaster threat. Failure of the computer is
also possible, but like you said, regular backups minimize problems from
that.
Niels
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:OPBjaKmREHA.2848@.TK2MSFTNGP10.phx.gbl...
> A disaster recovery plan will help you minimize data loss. You need to
> plan for various recovery scenarios according to the amount of data loss
> that is acceptable to you.
> The worst case is that you lose your computer completely due to a disaster
> such as for or theft. Your only recourse in this situation is to
reinstall
> SQL Server on a working machine and restore from backups you've kept in a
> safe location.
> If your computer crashes and/or you lose your SQL Server drive, you might
> get lucky with a successful attach of the database files if your database
> files are intact. However, you should not rely on this and plan on
> restoring your database from backup because you might not be able to
attach[vbcol=seagreen]
> databases which were not detached properly.
> The bottom line is that you need to backup your databases periodically and
> archive the backup files to a safe location.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Niels" <nkistrup@.comcast.net> wrote in message
> news:NeudnYnNW-kXTiTdRVn2tQ@.giganews.com...
> but
> 'network
hard[vbcol=seagreen]
drive
> has
>
|||I am not sure if you really mean another instance or just moving the data
files. If you want to install a second instance of sql server (binaries)
then you need to rerun the setup and point it to the other drive for the
install. If you just want to move the data files you can find what you need
here:
http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
to a New Location with Detach/Attach
http://support.microsoft.com/?id=221465 Using WITH MOVE in a
Restore
http://www.databasejournal.com/featu...le.php/2228611
Transferring Logins
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL Servers
http://www.sqlservercentral.com/scri...p?scriptid=599
Restoring a .mdf
This still does not mean you should not have valid backups. See BACKUP and
RESTORE in BooksOnLine for more info.
Andrew J. Kelly
SQL Server MVP
"Niels" <nkistrup@.comcast.net> wrote in message
news:GY6dneIma9N3zSfdRVn2tA@.giganews.com...
> Dan,
> Lets talk 'preemptive correction'. My data drive is 6 1/2 yrs old & have
> the replacement drive ready for swapping. How do you copy the server
> instance onto a new drive. From what I can see, it is not as easy as
> copying the SQL data folder to another drive, then onto the new one. (Or
is
> it?)
> I am still curious about creating other server instances on other hard
> drives. That way, I could spread the data across hard drives. Yes, I
need
> to transfer my data to a new drive, which will have the same drive. But
> just because I cannot figure how out how to create new server instances,
> makes me curious about the procedure. I work as a T-SQL developer, but my
> DBA skills are minimal, which is why I'm being such a persistent pest
about
> this.
> Hard drive crashes remain my #1 disaster threat. Failure of the computer
is[vbcol=seagreen]
> also possible, but like you said, regular backups minimize problems from
> that.
> Niels
> "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
> news:OPBjaKmREHA.2848@.TK2MSFTNGP10.phx.gbl...
disaster[vbcol=seagreen]
> reinstall
a[vbcol=seagreen]
might[vbcol=seagreen]
database[vbcol=seagreen]
> attach
and[vbcol=seagreen]
Server,[vbcol=seagreen]
> hard
> drive
and
>
Adding another server instance to another hard drive?
another hard drive. I'm trying to guard against a hard drive crash.
Currently, I detach, file copy to another drive, then reattach each
individual database. Since SQL Server is running on different hard drive
from the data, I know that I wouldn't have to reinstall it.
1) Is there a way to do what I am asking?
2) Is this the correct the newsgroup to post these questions?
3) Is there a book that covers this?
Tried various keywords, but couldn't find anything in Books Online. I'm
running MS SQL Server Developer's ed. under Windows 2000 Pro.
NielsThat is what backups are for. It's much easier to simply do a backup of
each database (including Master & MSDB) and store those in a different
location. Preferably on a different machine or medium altogether, You don't
have to take the databases off line for a backup like you do with detach.
You might want to take a look at this:
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlops0.mspx
--
Andrew J. Kelly
SQL Server MVP
"Niels" <nkistrup@.comcast.net> wrote in message
news:6v-dnY1yOZGJGCXdRVn2sQ@.giganews.com...
> Problem: For safety reasons, I want an exact copy of all SQL databases on
> another hard drive. I'm trying to guard against a hard drive crash.
> Currently, I detach, file copy to another drive, then reattach each
> individual database. Since SQL Server is running on different hard drive
> from the data, I know that I wouldn't have to reinstall it.
> 1) Is there a way to do what I am asking?
> 2) Is this the correct the newsgroup to post these questions?
> 3) Is there a book that covers this?
> Tried various keywords, but couldn't find anything in Books Online. I'm
> running MS SQL Server Developer's ed. under Windows 2000 Pro.
> Niels
>|||Thanks Andrew,
But I will still like to create another server. Where I can find the steps
to add additional server instances?
Niels
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:ev$827XREHA.568@.TK2MSFTNGP12.phx.gbl...
> That is what backups are for. It's much easier to simply do a backup of
> each database (including Master & MSDB) and store those in a different
> location. Preferably on a different machine or medium altogether, You
don't
> have to take the databases off line for a backup like you do with detach.
> You might want to take a look at this:
>
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlops0.mspx
> --
> Andrew J. Kelly
> SQL Server MVP
>
> "Niels" <nkistrup@.comcast.net> wrote in message
> news:6v-dnY1yOZGJGCXdRVn2sQ@.giganews.com...
> > Problem: For safety reasons, I want an exact copy of all SQL databases
on
> > another hard drive. I'm trying to guard against a hard drive crash.
> > Currently, I detach, file copy to another drive, then reattach each
> > individual database. Since SQL Server is running on different hard
drive
> > from the data, I know that I wouldn't have to reinstall it.
> >
> > 1) Is there a way to do what I am asking?
> > 2) Is this the correct the newsgroup to post these questions?
> > 3) Is there a book that covers this?
> >
> > Tried various keywords, but couldn't find anything in Books Online. I'm
> > running MS SQL Server Developer's ed. under Windows 2000 Pro.
> >
> > Niels
> >
> >
>|||There a couple of options that you might want to consider.
Firstly if your running NT 4, 2000 or 2003, then ask your network guys to
raid the disks, I wouldn't do into it in too much detail but there are
plenty of examples. What a raid does in automatically (non SQL Server) copy
stuff from one hard drive to another.
If you wish to create another instance on your current machine then that
will not really help as if the machine goes then both instances go.
If you want to create another server then you will need another machine to
do it then you just install SQL Server the normal way, that will create a
default instance on that machine.
If you want to keep your database running in case of server crashes then
create a new server and backup your databases on the other server.(using the
backup database command).
If you want a server to kick in automatically when your existing server dies
then look on Microsoft for Replication, and High Availabity Server.
"Niels" <nkistrup@.comcast.net> wrote in message
news:8fKdnfr3UYxtyCTdRVn2sw@.giganews.com...
> Thanks Andrew,
> But I will still like to create another server. Where I can find the
steps
> to add additional server instances?
> Niels
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:ev$827XREHA.568@.TK2MSFTNGP12.phx.gbl...
> > That is what backups are for. It's much easier to simply do a backup of
> > each database (including Master & MSDB) and store those in a different
> > location. Preferably on a different machine or medium altogether, You
> don't
> > have to take the databases off line for a backup like you do with
detach.
> > You might want to take a look at this:
> >
> >
>
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlops0.mspx
> >
> > --
> >
> > Andrew J. Kelly
> > SQL Server MVP
> >
> >
> > "Niels" <nkistrup@.comcast.net> wrote in message
> > news:6v-dnY1yOZGJGCXdRVn2sQ@.giganews.com...
> > > Problem: For safety reasons, I want an exact copy of all SQL databases
> on
> > > another hard drive. I'm trying to guard against a hard drive crash.
> > > Currently, I detach, file copy to another drive, then reattach each
> > > individual database. Since SQL Server is running on different hard
> drive
> > > from the data, I know that I wouldn't have to reinstall it.
> > >
> > > 1) Is there a way to do what I am asking?
> > > 2) Is this the correct the newsgroup to post these questions?
> > > 3) Is there a book that covers this?
> > >
> > > Tried various keywords, but couldn't find anything in Books Online.
I'm
> > > running MS SQL Server Developer's ed. under Windows 2000 Pro.
> > >
> > > Niels
> > >
> > >
> >
> >
>|||Peter,
So much for my mastery of English. I don't think I'm explaining the
situation correctly, sorry.
I'm running Win 2000 Pro, with the developer's edition of MS SQL Server, but
I have 4 hard drives ... and it's all on my home computer (I'm the 'network
guy'). Maybe another server instance is not the correct terminology?
Currently my data is on D:, but I would like to use one of the other hard
drives to actively store data.
If the computer crashes, I'm screwed, but I can always move the hard drive
to another machine. Heck the drive where the data is 6 1/2 yrs old, and has
migrated across machines in the past. (The hard drive.)
Niels
"Peter Nolan" <peter.nolan90@.ntlworld.com> wrote in message
news:x4luc.65$PA4.57@.newsfe1-gui.server.ntli.net...
> There a couple of options that you might want to consider.
> Firstly if your running NT 4, 2000 or 2003, then ask your network guys to
> raid the disks, I wouldn't do into it in too much detail but there are
> plenty of examples. What a raid does in automatically (non SQL Server)
copy
> stuff from one hard drive to another.
> If you wish to create another instance on your current machine then that
> will not really help as if the machine goes then both instances go.
> If you want to create another server then you will need another machine to
> do it then you just install SQL Server the normal way, that will create a
> default instance on that machine.
> If you want to keep your database running in case of server crashes then
> create a new server and backup your databases on the other server.(using
the
> backup database command).
> If you want a server to kick in automatically when your existing server
dies
> then look on Microsoft for Replication, and High Availabity Server.
>
> "Niels" <nkistrup@.comcast.net> wrote in message
> news:8fKdnfr3UYxtyCTdRVn2sw@.giganews.com...
> > Thanks Andrew,
> >
> > But I will still like to create another server. Where I can find the
> steps
> > to add additional server instances?
> >
> > Niels
> >
> > "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> > news:ev$827XREHA.568@.TK2MSFTNGP12.phx.gbl...
> > > That is what backups are for. It's much easier to simply do a backup
of
> > > each database (including Master & MSDB) and store those in a different
> > > location. Preferably on a different machine or medium altogether, You
> > don't
> > > have to take the databases off line for a backup like you do with
> detach.
> > > You might want to take a look at this:
> > >
> > >
> >
>
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlops0.mspx
> > >
> > > --
> > >
> > > Andrew J. Kelly
> > > SQL Server MVP
> > >
> > >
> > > "Niels" <nkistrup@.comcast.net> wrote in message
> > > news:6v-dnY1yOZGJGCXdRVn2sQ@.giganews.com...
> > > > Problem: For safety reasons, I want an exact copy of all SQL
databases
> > on
> > > > another hard drive. I'm trying to guard against a hard drive crash.
> > > > Currently, I detach, file copy to another drive, then reattach each
> > > > individual database. Since SQL Server is running on different hard
> > drive
> > > > from the data, I know that I wouldn't have to reinstall it.
> > > >
> > > > 1) Is there a way to do what I am asking?
> > > > 2) Is this the correct the newsgroup to post these questions?
> > > > 3) Is there a book that covers this?
> > > >
> > > > Tried various keywords, but couldn't find anything in Books Online.
> I'm
> > > > running MS SQL Server Developer's ed. under Windows 2000 Pro.
> > > >
> > > > Niels
> > > >
> > > >
> > >
> > >
> >
> >
>|||A disaster recovery plan will help you minimize data loss. You need to
plan for various recovery scenarios according to the amount of data loss
that is acceptable to you.
The worst case is that you lose your computer completely due to a disaster
such as for or theft. Your only recourse in this situation is to reinstall
SQL Server on a working machine and restore from backups you've kept in a
safe location.
If your computer crashes and/or you lose your SQL Server drive, you might
get lucky with a successful attach of the database files if your database
files are intact. However, you should not rely on this and plan on
restoring your database from backup because you might not be able to attach
databases which were not detached properly.
The bottom line is that you need to backup your databases periodically and
archive the backup files to a safe location.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Niels" <nkistrup@.comcast.net> wrote in message
news:NeudnYnNW-kXTiTdRVn2tQ@.giganews.com...
> Peter,
> So much for my mastery of English. I don't think I'm explaining the
> situation correctly, sorry.
> I'm running Win 2000 Pro, with the developer's edition of MS SQL Server,
but
> I have 4 hard drives ... and it's all on my home computer (I'm the
'network
> guy'). Maybe another server instance is not the correct terminology?
> Currently my data is on D:, but I would like to use one of the other hard
> drives to actively store data.
> If the computer crashes, I'm screwed, but I can always move the hard drive
> to another machine. Heck the drive where the data is 6 1/2 yrs old, and
has
> migrated across machines in the past. (The hard drive.)
> Niels
>|||Dan,
Lets talk 'preemptive correction'. My data drive is 6 1/2 yrs old & have
the replacement drive ready for swapping. How do you copy the server
instance onto a new drive. From what I can see, it is not as easy as
copying the SQL data folder to another drive, then onto the new one. (Or is
it?)
I am still curious about creating other server instances on other hard
drives. That way, I could spread the data across hard drives. Yes, I need
to transfer my data to a new drive, which will have the same drive. But
just because I cannot figure how out how to create new server instances,
makes me curious about the procedure. I work as a T-SQL developer, but my
DBA skills are minimal, which is why I'm being such a persistent pest about
this.
Hard drive crashes remain my #1 disaster threat. Failure of the computer is
also possible, but like you said, regular backups minimize problems from
that.
Niels
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:OPBjaKmREHA.2848@.TK2MSFTNGP10.phx.gbl...
> A disaster recovery plan will help you minimize data loss. You need to
> plan for various recovery scenarios according to the amount of data loss
> that is acceptable to you.
> The worst case is that you lose your computer completely due to a disaster
> such as for or theft. Your only recourse in this situation is to
reinstall
> SQL Server on a working machine and restore from backups you've kept in a
> safe location.
> If your computer crashes and/or you lose your SQL Server drive, you might
> get lucky with a successful attach of the database files if your database
> files are intact. However, you should not rely on this and plan on
> restoring your database from backup because you might not be able to
attach
> databases which were not detached properly.
> The bottom line is that you need to backup your databases periodically and
> archive the backup files to a safe location.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Niels" <nkistrup@.comcast.net> wrote in message
> news:NeudnYnNW-kXTiTdRVn2tQ@.giganews.com...
> > Peter,
> >
> > So much for my mastery of English. I don't think I'm explaining the
> > situation correctly, sorry.
> >
> > I'm running Win 2000 Pro, with the developer's edition of MS SQL Server,
> but
> > I have 4 hard drives ... and it's all on my home computer (I'm the
> 'network
> > guy'). Maybe another server instance is not the correct terminology?
> > Currently my data is on D:, but I would like to use one of the other
hard
> > drives to actively store data.
> >
> > If the computer crashes, I'm screwed, but I can always move the hard
drive
> > to another machine. Heck the drive where the data is 6 1/2 yrs old, and
> has
> > migrated across machines in the past. (The hard drive.)
> >
> > Niels
> >
>|||I am not sure if you really mean another instance or just moving the data
files. If you want to install a second instance of sql server (binaries)
then you need to rerun the setup and point it to the other drive for the
install. If you just want to move the data files you can find what you need
here:
http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
to a New Location with Detach/Attach
http://support.microsoft.com/?id=221465 Using WITH MOVE in a
Restore
http://www.databasejournal.com/features/mssql/article.php/2228611
Transferring Logins
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL Servers
http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
Restoring a .mdf
This still does not mean you should not have valid backups. See BACKUP and
RESTORE in BooksOnLine for more info.
Andrew J. Kelly
SQL Server MVP
"Niels" <nkistrup@.comcast.net> wrote in message
news:GY6dneIma9N3zSfdRVn2tA@.giganews.com...
> Dan,
> Lets talk 'preemptive correction'. My data drive is 6 1/2 yrs old & have
> the replacement drive ready for swapping. How do you copy the server
> instance onto a new drive. From what I can see, it is not as easy as
> copying the SQL data folder to another drive, then onto the new one. (Or
is
> it?)
> I am still curious about creating other server instances on other hard
> drives. That way, I could spread the data across hard drives. Yes, I
need
> to transfer my data to a new drive, which will have the same drive. But
> just because I cannot figure how out how to create new server instances,
> makes me curious about the procedure. I work as a T-SQL developer, but my
> DBA skills are minimal, which is why I'm being such a persistent pest
about
> this.
> Hard drive crashes remain my #1 disaster threat. Failure of the computer
is
> also possible, but like you said, regular backups minimize problems from
> that.
> Niels
> "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
> news:OPBjaKmREHA.2848@.TK2MSFTNGP10.phx.gbl...
> > A disaster recovery plan will help you minimize data loss. You need to
> > plan for various recovery scenarios according to the amount of data loss
> > that is acceptable to you.
> >
> > The worst case is that you lose your computer completely due to a
disaster
> > such as for or theft. Your only recourse in this situation is to
> reinstall
> > SQL Server on a working machine and restore from backups you've kept in
a
> > safe location.
> >
> > If your computer crashes and/or you lose your SQL Server drive, you
might
> > get lucky with a successful attach of the database files if your
database
> > files are intact. However, you should not rely on this and plan on
> > restoring your database from backup because you might not be able to
> attach
> > databases which were not detached properly.
> >
> > The bottom line is that you need to backup your databases periodically
and
> > archive the backup files to a safe location.
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> > "Niels" <nkistrup@.comcast.net> wrote in message
> > news:NeudnYnNW-kXTiTdRVn2tQ@.giganews.com...
> > > Peter,
> > >
> > > So much for my mastery of English. I don't think I'm explaining the
> > > situation correctly, sorry.
> > >
> > > I'm running Win 2000 Pro, with the developer's edition of MS SQL
Server,
> > but
> > > I have 4 hard drives ... and it's all on my home computer (I'm the
> > 'network
> > > guy'). Maybe another server instance is not the correct terminology?
> > > Currently my data is on D:, but I would like to use one of the other
> hard
> > > drives to actively store data.
> > >
> > > If the computer crashes, I'm screwed, but I can always move the hard
> drive
> > > to another machine. Heck the drive where the data is 6 1/2 yrs old,
and
> > has
> > > migrated across machines in the past. (The hard drive.)
> > >
> > > Niels
> > >
> >
> >
>
Adding and Updating in same query
I am trying to copy records from table 1 where field 1 is equal to "N" to
table 2. I also want to change field1 to "Y" after the copy or delete the
record, so that the record will not get copied again.
Can this be done?
Thank you,
George
One thing I need to mention: I am trying to accomplish this in the
Transformation
Thanks again.
George
|||> One thing I need to mention: I am trying to accomplish this in the
> Transformation
What is "the Transformation"?
|||Of course you can handle this in multiple ways, e.g. one way would be to use
Y on insert
INSERT INTO table2(field1, pk) SELECT 'Y', pk
FROM table1 t1
LEFT OUTER JOIN table2 t2
ON t1.pk = t2.pk
WHERE t2.pk IS NULL
Or not have a "field1" at all. Assuming you can identify any row in either
table uniquely, and properly identify a duplicate, you can easily use a
similar LEFT JOIN without needing a flag.
Or not have two tables at all. What are you trying to accomplish with two
tables that you can't accomplish with one?
If this isn't helpful, then instead of an ambiguous word problem, please
post DDL, sample data and desired results. See http://www.aspfaq.com/5006
for info.
"George" <George@.discussions.microsoft.com> wrote in message
news:CB84E118-4A8C-43BD-9A22-6C58E98D5461@.microsoft.com...
> Hi all,
> I am trying to copy records from table 1 where field 1 is equal to "N" to
> table 2. I also want to change field1 to "Y" after the copy or delete the
> record, so that the record will not get copied again.
> Can this be done?
> Thank you,
> George
|||Hi George,
INSERT INTO TABLE2 SELECT <FIELDS> FROM TABLE1 WHERE FIELD1='N'
GO
UPDATE TABLE1 SET FIELD1='Y'
GO
Hope this will solve the problem
thanks and regards
Chandra
"George" wrote:
> Hi all,
> I am trying to copy records from table 1 where field 1 is equal to "N" to
> table 2. I also want to change field1 to "Y" after the copy or delete the
> record, so that the record will not get copied again.
> Can this be done?
> Thank you,
> George
Adding and Updating in same query
I am trying to copy records from table 1 where field 1 is equal to "N" to
table 2. I also want to change field1 to "Y" after the copy or delete the
record, so that the record will not get copied again.
Can this be done?
Thank you,
GeorgeOne thing I need to mention: I am trying to accomplish this in the
Transformation
Thanks again.
George|||> One thing I need to mention: I am trying to accomplish this in the
> Transformation
What is "the Transformation"?|||Of course you can handle this in multiple ways, e.g. one way would be to use
Y on insert
INSERT INTO table2(field1, pk) SELECT 'Y', pk
FROM table1 t1
LEFT OUTER JOIN table2 t2
ON t1.pk = t2.pk
WHERE t2.pk IS NULL
Or not have a "field1" at all. Assuming you can identify any row in either
table uniquely, and properly identify a duplicate, you can easily use a
similar LEFT JOIN without needing a flag.
Or not have two tables at all. What are you trying to accomplish with two
tables that you can't accomplish with one?
If this isn't helpful, then instead of an ambiguous word problem, please
post DDL, sample data and desired results. See http://www.aspfaq.com/5006
for info.
"George" <George@.discussions.microsoft.com> wrote in message
news:CB84E118-4A8C-43BD-9A22-6C58E98D5461@.microsoft.com...
> Hi all,
> I am trying to copy records from table 1 where field 1 is equal to "N" to
> table 2. I also want to change field1 to "Y" after the copy or delete the
> record, so that the record will not get copied again.
> Can this be done?
> Thank you,
> George|||Hi George,
INSERT INTO TABLE2 SELECT <FIELDS> FROM TABLE1 WHERE FIELD1='N'
GO
UPDATE TABLE1 SET FIELD1='Y'
GO
Hope this will solve the problem
thanks and regards
Chandra
"George" wrote:
> Hi all,
> I am trying to copy records from table 1 where field 1 is equal to "N" to
> table 2. I also want to change field1 to "Y" after the copy or delete the
> record, so that the record will not get copied again.
> Can this be done?
> Thank you,
> George
Adding and Updating in same query
I am trying to copy records from table 1 where field 1 is equal to "N" to
table 2. I also want to change field1 to "Y" after the copy or delete the
record, so that the record will not get copied again.
Can this be done?
Thank you,
GeorgeOne thing I need to mention: I am trying to accomplish this in the
Transformation
Thanks again.
George|||> One thing I need to mention: I am trying to accomplish this in the
> Transformation
What is "the Transformation"?|||Of course you can handle this in multiple ways, e.g. one way would be to use
Y on insert
INSERT INTO table2(field1, pk) SELECT 'Y', pk
FROM table1 t1
LEFT OUTER JOIN table2 t2
ON t1.pk = t2.pk
WHERE t2.pk IS NULL
Or not have a "field1" at all. Assuming you can identify any row in either
table uniquely, and properly identify a duplicate, you can easily use a
similar LEFT JOIN without needing a flag.
Or not have two tables at all. What are you trying to accomplish with two
tables that you can't accomplish with one?
If this isn't helpful, then instead of an ambiguous word problem, please
post DDL, sample data and desired results. See http://www.aspfaq.com/5006
for info.
"George" <George@.discussions.microsoft.com> wrote in message
news:CB84E118-4A8C-43BD-9A22-6C58E98D5461@.microsoft.com...
> Hi all,
> I am trying to copy records from table 1 where field 1 is equal to "N" to
> table 2. I also want to change field1 to "Y" after the copy or delete the
> record, so that the record will not get copied again.
> Can this be done?
> Thank you,
> George|||Hi George,
INSERT INTO TABLE2 SELECT <FIELDS> FROM TABLE1 WHERE FIELD1='N'
GO
UPDATE TABLE1 SET FIELD1='Y'
GO
Hope this will solve the problem
thanks and regards
Chandra
"George" wrote:
> Hi all,
> I am trying to copy records from table 1 where field 1 is equal to "N" to
> table 2. I also want to change field1 to "Y" after the copy or delete the
> record, so that the record will not get copied again.
> Can this be done?
> Thank you,
> George
Thursday, February 9, 2012
Adding a user to a Read-Only database
I currently have a sql server 2000 sp4 instance with a read-only db on it. We get tlogs shipped from an outside vendor and keep a copy of the production database in house for reporting purposes. The database is in read-only mode because we apply new tlogs daily. Recently we did a full recover and applied 2 tlogs.
The issue:
There is a user YYY in the database and at the server level, but they aren't linked. So I do what I usually do and run the following command:
exec sp_change_users_login 'Update_One', 'YYY','YYY'
Except for I get the following error:
Server: Msg 3906, Level 16, State 1, Procedure sp_change_users_login, Line 109
Could not run BEGIN TRANSACTION in database 'ZZZ' because the database is read-only.
Now this error makes sense and I understand why, so my question is how do I fix the users not being linked?Easiest would be to drop the login on your server, and re-create it with the SID of the user in the database. Alternatively, you can try to have the vendor drop the user and login on their end, and recreate it with your login's SID. The new SID will be brought to your server with the appropriate TLog restore.