Showing posts with label experts. Show all posts
Showing posts with label experts. Show all posts

Sunday, March 11, 2012

Applying business rules to the database

Hi Experts,
My system stores events into a large table. I would like to apply some
rules on that table and possibly take action if the rules were satisfied.
For example if a certain event arrives 2 times in 60 seconds then perform an
action. What is the best way to apply rules to data in the database? If it
cannot be done with the database itself a recommendation of a third party
tool will be great. However please not that I cannot use any GUI. I need
to declare the rules and get the result of the rule into my application
which can be in C++ or C#
Thanks for all the help,
AviHave you looked at streaming databases? Google up BitStream.|||You could use triggers in SQL but if you need to invoke external code
against the database then it's better to put this in a middle-tier
application. In your middle-tier code, poll the table regularly for the
changes based on a date-time stamp column.
David Portas
SQL Server MVP
--

Apply Old Transaction Logs

Hello Experts,
This may be a wacky question, but I'm gonna ask it anyway.
Can I apply some old tran logs in my db which now has a
different structure (changed after when the old tran logs
backed up) and ignore any additional/removed fields?
Thanks in advance?
No, if you are going to restore transaction logs the database has to be =
in standby mode. You place the database in standby mode when restoring =
a full database backup by specifying the WITH STANDBY option.
--=20
Keith
"Konstantinos Michas" <anonymous@.discussions.microsoft.com> wrote in =
message news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
> Hello Experts,
>=20
> This may be a wacky question, but I'm gonna ask it anyway.
>=20
> Can I apply some old tran logs in my db which now has a=20
> different structure (changed after when the old tran logs=20
> backed up) and ignore any additional/removed fields?
>=20
> Thanks in advance?
|||Hello Keith and you responding to my issue, why use
STANDBY, so users don't hurt my db while restore?
Thanks in advance.

>--Original Message--
>No, if you are going to restore transaction logs the
database has to be in standby mode. You place the
database in standby mode when restoring a full database
backup by specifying the WITH STANDBY option.
>--
>Keith
>
>"Konstantinos Michas"
<anonymous@.discussions.microsoft.com> wrote in message
news:a88c01c43687$85adeef0$a401280a@.phx.gbl...[vbcol=seagreen]
anyway.[vbcol=seagreen]
a[vbcol=seagreen]
logs
>.
>
|||You have to use STANDBY (or NORECOVERY) if you want to apply transaction =
logs. From Books Online:
Navigate to SQL Server Books Online (within the SQL Server program =
group) and search for RESTORE within the index tab. Read up on 'RESTORE =
(described).' Within that section will will find the following:
NORECOVERY
Instructs the restore operation to not roll back any uncommitted =
transactions. Either the NORECOVERY or STANDBY option must be specified =
if another transaction log has to be applied. If neither NORECOVERY, =
RECOVERY, or STANDBY is specified, RECOVERY is the default.
SQL Server requires that the WITH NORECOVERY option be used on all but =
the final RESTORE statement when restoring a database backup and =
multiple transaction logs, or when multiple RESTORE statements are =
needed (for example, a full database backup followed by a differential =
database backup).
--=20
Keith
"Konstantinos" <anonymous@.discussions.microsoft.com> wrote in message =
news:ac3b01c4368e$d3106720$a101280a@.phx.gbl...[vbcol=seagreen]
>=20
> Hello Keith and you responding to my issue, why use=20
> STANDBY, so users don't hurt my db while restore?
>=20
> Thanks in advance.
>=20
> database has to be in standby mode. You place the=20
> database in standby mode when restoring a full database=20
> backup by specifying the WITH STANDBY option.
> <anonymous@.discussions.microsoft.com> wrote in message=20
> news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
> anyway.
> a=20
> logs=20
|||"Konstantinos Michas" <anonymous@.discussions.microsoft.com> wrote in message
news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
> Hello Experts,
> This may be a wacky question, but I'm gonna ask it anyway.
>
No it is not a wacky question.

> Can I apply some old tran logs in my db which now has a
> different structure (changed after when the old tran logs
> backed up) and ignore any additional/removed fields?
What you want is a replay of the log in another
context/database.
The anwser to your question is : NO !
You can only apply the log files to the backups of
the database to which they belong and not to another
or a changed database.
http://www.lumigent.com/
Here you find some tools which can do more things
with a logfile. They have a tool 'Log Explorer' which
might be the tool you are looking for.
But if it works it is not as straitforward as 'replaying'
a log. And the tool is not a free tool.
Good luck and keep us informed.
ben brugman.

> Thanks in advance?

Apply Old Transaction Logs

Hello Experts,
This may be a wacky question, but I'm gonna ask it anyway.
Can I apply some old tran logs in my db which now has a
different structure (changed after when the old tran logs
backed up) and ignore any additional/removed fields?
Thanks in advance?No, if you are going to restore transaction logs the database has to be =in standby mode. You place the database in standby mode when restoring =a full database backup by specifying the WITH STANDBY option.
-- Keith
"Konstantinos Michas" <anonymous@.discussions.microsoft.com> wrote in =message news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
> Hello Experts,
> > This may be a wacky question, but I'm gonna ask it anyway.
> > Can I apply some old tran logs in my db which now has a > different structure (changed after when the old tran logs > backed up) and ignore any additional/removed fields?
> > Thanks in advance?|||Hello Keith and you responding to my issue, why use
STANDBY, so users don't hurt my db while restore?
Thanks in advance.
>--Original Message--
>No, if you are going to restore transaction logs the
database has to be in standby mode. You place the
database in standby mode when restoring a full database
backup by specifying the WITH STANDBY option.
>--
>Keith
>
>"Konstantinos Michas"
<anonymous@.discussions.microsoft.com> wrote in message
news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
>> Hello Experts,
>> This may be a wacky question, but I'm gonna ask it
anyway.
>> Can I apply some old tran logs in my db which now has
a
>> different structure (changed after when the old tran
logs
>> backed up) and ignore any additional/removed fields?
>> Thanks in advance?
>.
>|||You have to use STANDBY (or NORECOVERY) if you want to apply transaction =logs. From Books Online:
Navigate to SQL Server Books Online (within the SQL Server program =group) and search for RESTORE within the index tab. Read up on 'RESTORE =(described).' Within that section will will find the following:
NORECOVERY
Instructs the restore operation to not roll back any uncommitted =transactions. Either the NORECOVERY or STANDBY option must be specified =if another transaction log has to be applied. If neither NORECOVERY, =RECOVERY, or STANDBY is specified, RECOVERY is the default.
SQL Server requires that the WITH NORECOVERY option be used on all but =the final RESTORE statement when restoring a database backup and =multiple transaction logs, or when multiple RESTORE statements are =needed (for example, a full database backup followed by a differential =database backup).
-- Keith
"Konstantinos" <anonymous@.discussions.microsoft.com> wrote in message =news:ac3b01c4368e$d3106720$a101280a@.phx.gbl...
> > Hello Keith and you responding to my issue, why use > STANDBY, so users don't hurt my db while restore?
> > Thanks in advance.
> > >--Original Message--
> >No, if you are going to restore transaction logs the > database has to be in standby mode. You place the > database in standby mode when restoring a full database > backup by specifying the WITH STANDBY option.
> >
> >-- > >Keith
> >
> >
> >"Konstantinos Michas" > <anonymous@.discussions.microsoft.com> wrote in message > news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
> >> Hello Experts,
> >> > >> This may be a wacky question, but I'm gonna ask it > anyway.
> >> > >> Can I apply some old tran logs in my db which now has > a > >> different structure (changed after when the old tran > logs > >> backed up) and ignore any additional/removed fields?
> >> > >> Thanks in advance?
> >.
> >|||"Konstantinos Michas" <anonymous@.discussions.microsoft.com> wrote in message
news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
> Hello Experts,
> This may be a wacky question, but I'm gonna ask it anyway.
>
No it is not a wacky question.
> Can I apply some old tran logs in my db which now has a
> different structure (changed after when the old tran logs
> backed up) and ignore any additional/removed fields?
What you want is a replay of the log in another
context/database.
The anwser to your question is : NO !
You can only apply the log files to the backups of
the database to which they belong and not to another
or a changed database.
http://www.lumigent.com/
Here you find some tools which can do more things
with a logfile. They have a tool 'Log Explorer' which
might be the tool you are looking for.
But if it works it is not as straitforward as 'replaying'
a log. And the tool is not a free tool.
Good luck and keep us informed.
ben brugman.
> Thanks in advance?

Apply Old Transaction Logs

Hello Experts,
This may be a wacky question, but I'm gonna ask it anyway.
Can I apply some old tran logs in my db which now has a
different structure (changed after when the old tran logs
backed up) and ignore any additional/removed fields?
Thanks in advance?No, if you are going to restore transaction logs the database has to be =
in standby mode. You place the database in standby mode when restoring =
a full database backup by specifying the WITH STANDBY option.
--=20
Keith
"Konstantinos Michas" <anonymous@.discussions.microsoft.com> wrote in =
message news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
> Hello Experts,
>=20
> This may be a wacky question, but I'm gonna ask it anyway.
>=20
> Can I apply some old tran logs in my db which now has a=20
> different structure (changed after when the old tran logs=20
> backed up) and ignore any additional/removed fields?
>=20
> Thanks in advance?|||Hello Keith and you responding to my issue, why use
STANDBY, so users don't hurt my db while restore?
Thanks in advance.

>--Original Message--
>No, if you are going to restore transaction logs the
database has to be in standby mode. You place the
database in standby mode when restoring a full database
backup by specifying the WITH STANDBY option.
>--
>Keith
>
>"Konstantinos Michas"
<anonymous@.discussions.microsoft.com> wrote in message
news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
anyway.[vbcol=seagreen]
a[vbcol=seagreen]
logs[vbcol=seagreen]
>.
>|||You have to use STANDBY (or NORECOVERY) if you want to apply transaction =
logs. From Books Online:
Navigate to SQL Server Books Online (within the SQL Server program =
group) and search for RESTORE within the index tab. Read up on 'RESTORE =
(described).' Within that section will will find the following:
NORECOVERY
Instructs the restore operation to not roll back any uncommitted =
transactions. Either the NORECOVERY or STANDBY option must be specified =
if another transaction log has to be applied. If neither NORECOVERY, =
RECOVERY, or STANDBY is specified, RECOVERY is the default.
SQL Server requires that the WITH NORECOVERY option be used on all but =
the final RESTORE statement when restoring a database backup and =
multiple transaction logs, or when multiple RESTORE statements are =
needed (for example, a full database backup followed by a differential =
database backup).
--=20
Keith
"Konstantinos" <anonymous@.discussions.microsoft.com> wrote in message =
news:ac3b01c4368e$d3106720$a101280a@.phx.gbl...[vbcol=seagreen]
>=20
> Hello Keith and you responding to my issue, why use=20
> STANDBY, so users don't hurt my db while restore?
>=20
> Thanks in advance.
>=20
> database has to be in standby mode. You place the=20
> database in standby mode when restoring a full database=20
> backup by specifying the WITH STANDBY option.
> <anonymous@.discussions.microsoft.com> wrote in message=20
> news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
> anyway.
> a=20
> logs=20|||"Konstantinos Michas" <anonymous@.discussions.microsoft.com> wrote in message
news:a88c01c43687$85adeef0$a401280a@.phx.gbl...
> Hello Experts,
> This may be a wacky question, but I'm gonna ask it anyway.
>
No it is not a wacky question.

> Can I apply some old tran logs in my db which now has a
> different structure (changed after when the old tran logs
> backed up) and ignore any additional/removed fields?
What you want is a replay of the log in another
context/database.
The anwser to your question is : NO !
You can only apply the log files to the backups of
the database to which they belong and not to another
or a changed database.
http://www.lumigent.com/
Here you find some tools which can do more things
with a logfile. They have a tool 'Log Explorer' which
might be the tool you are looking for.
But if it works it is not as straitforward as 'replaying'
a log. And the tool is not a free tool.
Good luck and keep us informed.
ben brugman.

> Thanks in advance?

Sunday, February 12, 2012

API for Synonyms

Hi Experts:

I am writing a general API which would fetch synonyms from any database
providers (and would filter for a given schema).

I am using GetSchema method on DBConnection object and it works fine for
oracle.

SQL Server 2005 has a support for synonyms, but the above piece of code does
not work. Is there any API by which i can get the list?.

Thanks

AK

bets thing would be to use the SMO libraries, a sample script would be:

Code Snippet

foreach (Synonym s in s.Databases["Somedb"].Synonyms)

{

Console.WriteLine(s.Name);

}

Jens K. Suessmeyer.

http://www.sqlserver2005.de