Showing posts with label setup. Show all posts
Showing posts with label setup. Show all posts

Friday, March 30, 2012

Recovery model setup using Tsql

hi,
i need to change my recovery model to SIMPLE but using TSQL and once
installationn is finished i need to revert back to FULL
can anyone Help.
--
SunnyHi
ALTER DATABASE test SET RECOVERY FULL
"Sanjay" <Sanjay@.discussions.microsoft.com> wrote in message
news:B1DD8BA0-1BE1-434C-9A12-6E3F043E1FE6@.microsoft.com...
> hi,
> i need to change my recovery model to SIMPLE but using TSQL and once
> installationn is finished i need to revert back to FULL
> can anyone Help.
> --
> Sunny|||ALTER DATABASE dbname SET RECOVERY SIMPLE
...
ALTER DATABASE dbname SET RECOVERY FULL
Note that transaction log backups now takes are useless (SQL Server should g
ive an error message but
it doesn't, fixed in 2005), until you first do a database backup.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Sanjay" <Sanjay@.discussions.microsoft.com> wrote in message
news:B1DD8BA0-1BE1-434C-9A12-6E3F043E1FE6@.microsoft.com...
> hi,
> i need to change my recovery model to SIMPLE but using TSQL and once
> installationn is finished i need to revert back to FULL
> can anyone Help.
> --
> Sunnysql

Friday, March 9, 2012

Recover data from corrupt DB

Hi all:
I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
VHD files, I never backed up the DBs themselves. Now for some reason all of
the images have an error in the MSCRM Metabase database, and I cannot
recover it. I tried this:
1. alter database Adventure_Works_Cycle_METABASE set emergency
2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
Which got the DB back online, but it dumped a bunch of necessary data and
broke MSCRM.
Can anyone make any suggestions as to how I can save the data? The metabase
tracks customizations to MSCRM, so if I lose it I'll lose all of my work.
Thanks in advance for any and all help.
John.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/
John
http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
"John" <jstraumann@.nospam.hotmail.com> wrote in message
news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
> Hi all:
> I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
> VHD files, I never backed up the DBs themselves. Now for some reason all
> of the images have an error in the MSCRM Metabase database, and I cannot
> recover it. I tried this:
> 1. alter database Adventure_Works_Cycle_METABASE set emergency
> 2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
> 3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
> 4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
> Which got the DB back online, but it dumped a bunch of necessary data and
> broke MSCRM.
> Can anyone make any suggestions as to how I can save the data? The
> metabase tracks customizations to MSCRM, so if I lose it I'll lose all of
> my work.
> Thanks in advance for any and all help.
> John.
> --
> This message sent from Windows Vista Ultimate
> http://mscrmguy.blogspot.com/
>
|||Thanks but those steps only work if the DB is backed up.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23039dpcGHHA.1188@.TK2MSFTNGP06.phx.gbl...
> John
> http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
>
> "John" <jstraumann@.nospam.hotmail.com> wrote in message
> news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
>

Recover data from corrupt DB

Hi all:
I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
VHD files, I never backed up the DBs themselves. Now for some reason all of
the images have an error in the MSCRM Metabase database, and I cannot
recover it. I tried this:
1. alter database Adventure_Works_Cycle_METABASE set emergency
2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
Which got the DB back online, but it dumped a bunch of necessary data and
broke MSCRM.
Can anyone make any suggestions as to how I can save the data? The metabase
tracks customizations to MSCRM, so if I lose it I'll lose all of my work.
Thanks in advance for any and all help.
John.
--
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/John
http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
"John" <jstraumann@.nospam.hotmail.com> wrote in message
news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
> Hi all:
> I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
> VHD files, I never backed up the DBs themselves. Now for some reason all
> of the images have an error in the MSCRM Metabase database, and I cannot
> recover it. I tried this:
> 1. alter database Adventure_Works_Cycle_METABASE set emergency
> 2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
> 3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
> 4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
> Which got the DB back online, but it dumped a bunch of necessary data and
> broke MSCRM.
> Can anyone make any suggestions as to how I can save the data? The
> metabase tracks customizations to MSCRM, so if I lose it I'll lose all of
> my work.
> Thanks in advance for any and all help.
> John.
> --
> This message sent from Windows Vista Ultimate
> http://mscrmguy.blogspot.com/
>|||Thanks but those steps only work if the DB is backed up.
--
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23039dpcGHHA.1188@.TK2MSFTNGP06.phx.gbl...
> John
> http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
>
> "John" <jstraumann@.nospam.hotmail.com> wrote in message
> news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
>> Hi all:
>> I have MSCRM running in a VPC setup, so since I had 4 backup copies of
>> the VHD files, I never backed up the DBs themselves. Now for some reason
>> all of the images have an error in the MSCRM Metabase database, and I
>> cannot recover it. I tried this:
>> 1. alter database Adventure_Works_Cycle_METABASE set emergency
>> 2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
>> 3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
>> 4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
>> Which got the DB back online, but it dumped a bunch of necessary data and
>> broke MSCRM.
>> Can anyone make any suggestions as to how I can save the data? The
>> metabase tracks customizations to MSCRM, so if I lose it I'll lose all of
>> my work.
>> Thanks in advance for any and all help.
>> John.
>> --
>> This message sent from Windows Vista Ultimate
>> http://mscrmguy.blogspot.com/
>

Recover data from corrupt DB

Hi all:
I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
VHD files, I never backed up the DBs themselves. Now for some reason all of
the images have an error in the MSCRM Metabase database, and I cannot
recover it. I tried this:
1. alter database Adventure_Works_Cycle_METABASE set emergency
2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
Which got the DB back online, but it dumped a bunch of necessary data and
broke MSCRM.
Can anyone make any suggestions as to how I can save the data? The metabase
tracks customizations to MSCRM, so if I lose it I'll lose all of my work.
Thanks in advance for any and all help.
John.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/John
http://www.karaszi.com/SQLServer/in..._suspect_db.asp
"John" <jstraumann@.nospam.hotmail.com> wrote in message
news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
> Hi all:
> I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
> VHD files, I never backed up the DBs themselves. Now for some reason all
> of the images have an error in the MSCRM Metabase database, and I cannot
> recover it. I tried this:
> 1. alter database Adventure_Works_Cycle_METABASE set emergency
> 2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
> 3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
> 4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
> Which got the DB back online, but it dumped a bunch of necessary data and
> broke MSCRM.
> Can anyone make any suggestions as to how I can save the data? The
> metabase tracks customizations to MSCRM, so if I lose it I'll lose all of
> my work.
> Thanks in advance for any and all help.
> John.
> --
> This message sent from Windows Vista Ultimate
> http://mscrmguy.blogspot.com/
>|||Thanks but those steps only work if the DB is backed up.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23039dpcGHHA.1188@.TK2MSFTNGP06.phx.gbl...
> John
> http://www.karaszi.com/SQLServer/in..._suspect_db.asp
>
> "John" <jstraumann@.nospam.hotmail.com> wrote in message
> news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
>

Saturday, February 25, 2012

Records NOT in OTHER table - SELECT statement

I am trying to compare 2 tables with similar data. One table has a field named [X Sent] and the other table has a field named [X Setup]. I was trying to extract all of the fields in Table 1 with field [X Sent] that are not yet in Table 2, i.e. field [X Setup]. I was trying some LEFT JOINS and other stuff but I can't seem to get the syntax correct. How can I get a query of only the fields that are not in Table 2, but are in Table 1?

Here are two of my attempts:

SELECT [X Sent], [X Date]
FROM [Table 1]
WHERE ([X Sent] NOT IN
(SELECT [Table 1].[X Sent]
FROM [Table 2] INNER JOIN
[Table 1] ON [Table 2].[X Setup]= [Table 1].[X Sent]))

I don't believe 'NOT IN' is proper syntax!

And my other attempt:

SELECT [Table 1].[X Sent]
FROM [Table 1] LEFT OUTER JOIN
[Table 2] ON [Table 2].[X Setup]= [Table 1].[X Sent]

Any help would greatly be appreciated.An outer join, checking for NULL in [Table 2] will do it.


SELECT [X Sent],[X Date] FROM
[Table 1] t1 LEFT OUTER JOIN [Table 2] t2 ON t1.[X Sent]=t2.[X Setup]
WHERE t2.[X Setup] IS NULL
|||Thanks once again Douglas Reilly!!!!

Greatly appreciative...|||After analyzing the data further, I have noticed that I can't only compare one field, but rather two from each table. I have been trying to work with the following statement, but I can't seem to get it to work. To start off with, I would like to capture all the fields where Field1 and Field2 from Table1 equals Field1 and Field2 of Table2.

SELECT [Field1], [Field2]
FROM Table1 t1 INNER JOIN
Table2 t2 ON t1.Field1 = t2.Field1 AND t1.Field2 = t2.Field2

Once I figure this part out, I will go ahead and search for all of these tuples not in the other table. Your assistance will greatly be appreciated.|||You should pick one of your candidate keys to be the primary key of Table1. Then you can do this:

select * from Table1
where Table1PrimaryKey not in
(select Table1PrimaryKey from Table1
inner join Table2 on Table1.Field1=Table2.Field1 and Table1.Field2=Table2.Field2)

If for some reason you really need the fields, you can use this:

select Table1.Field1, Table1.Field2
from Table1
inner join Table2 on Table1.Field1=Table2.Field1 and Table1.Field2=Table2.Field2