Showing posts with label databases. Show all posts
Showing posts with label databases. Show all posts

Friday, March 30, 2012

Multi Table Query

Does anyone know how to create a query using tables from different sql server database's? looking for the simplest solution.

I have two databases in sql server. Both are in the same "server registration"
How do i reference a table in another database?

Do i do something like this?

SELECT Database1.Table1.Fields, Database2.Table1.Fields
FROM Database1.table1.PKField INNER JOIN Database2.table1.FKField;You may try this

SELECT Database1.dbo.Table1.Fields,
Database2.dbo.Table1.Fields FROM
Database1.dbo.table1.PKField INNER JOIN
Database2.dbo.table1.FKField|||you might also want to look at the OPENQUERY funtion. buddu's suggestion will work but you can generate a buch of unwanted I/O if the table on the remote server is big.|||You only need to do the full naming convension in the FROM clause

SELECT x.column1,
x.column2,
y.column1,
y.column3
FROM database1.dbo.tableX x
JOIN database2.dbo.tabley y
ON x.pk = y.pk|||can anyone help me please...
what query/syntax could i use for retrieving fields from various tables in Access for my one FORM.?
Ive tried using every possible codes but then it didn't work out.
SHould i declare diffrent recordsets for accesing this?

Multi Server/Database Nightmare

We have a setup with a web server and multiple databases, and a live, stage, and dev environment. We use SQL Server standard 2005 and use the ASP.NET ReportView control. I have spent countless hours now trying to get this to work and am about to give this up and go back to Crystal.

First I wanted a report that would work from dev to stage to live without modification, so we set up shared data sources on each environment to point to the appropriate database. No problem, I can publish it to each environment and it works, though sometimes I have to go into Report Manager and fix the data source.

Next I wanted to be able to work with multiple databases, identical in structure. For this we did a hidden parameter with the database name and used a formula for the query string. This works pretty well.

Next I wanted to be able to run against multiple database servers from a single web server. This has been nearly impossible. I've read a million posts about this, and nothing seems to work well. I've tried a dynamic connection string, and passing the server in as a parameter, but this doesn't work, because I can't get the credentials set on the ReportViewer.ServerReport, so it doesn't work from dev to stage. You can't programatically change the shared data source - that would make it too easy. Linked servers are not an option.

I guess I need to either publish a copy of the report for each database server, or set up an instance of SQL on the web server for each database server.

Any other reasonable options out there. I just can't imagine my setup is all that unique.

Have you explored the possibility of using Synonyms?

(Even dyanmically creating them when necessary.)

|||Whats a Synonym?

Monday, March 26, 2012

multi databases or partitions

Hi all

i have 3 million customer stored in a billing system.

currently i dived them to 40 database running sql2000.

i plan to migrate to sql 2005.

Is it better to let all customer in one partioned table based on city.?

or divide them one database for city.

taking into account there is 15 million transaction per month.

i want to get best performance and maintainance for backup.

thanks

Hi,

I would go for the partioned table. It is easier to remain within 1 database. I think there is more overhead in going to multiple databases anyway. With the partioned tables in 2005, you can span your data on multiple disks.

Greetz,

Geert

Geert Verhoeven
Consultant @. Ausy Belgium

My Personal Blog

|||

Hi Geert Verhoeven

Thank you for reply.

I use one storage Raid-5 for database storage composed of of 8 disk*73GB . In that case ,can that fullfill "span data on multiple disks".

Is there overhead for table partition compared to multi databases.

Just i want to know the side effect before starting merging data in one database using partitioned tables.

thanks

|||

Hi,

Indeed since you are using Raid, the spanning multiple disks is not an argument. Partioned tables can be processed by different processors but that is the same for multiple databases.

I still think that multiple databases give you more overhead then remaining in one database but it is hard to tell. Either way, I don't think that partitioned tables will be slower than multiple databases. Partitioned tables are easier to manage then multiple databases.

Greetz,

Geert

Geert Verhoeven
Consultant @. Ausy Belgium

My Personal Blog

|||

Since you have 40 different databases, I assume you want to be able to backup a portion (i.e. database in this case) and also that your data for one city does not interact with data in another city. With table partitioning, you can get the same convenience. you can partition by the city. You can possibly put each partition in its own file group there by mapped to diiferentg disk, you can backup/restore at filegroup granularity. Since partitioned table is managed as one logical unit, you won't need to worry about making schema changes in 40 databases, for example if you want to create an index.

multi databases or partitions

Hi all

i have 3 million customer stored in a billing system.

currently i dived them to 40 database running sql2000.

i plan to migrate to sql 2005.

Is it better to let all customer in one partioned table based on city.?

or divide them one database for city.

taking into account there is 15 million transaction per month.

i want to get best performance and maintainance for backup.

thanks

Hi,

I would go for the partioned table. It is easier to remain within 1 database. I think there is more overhead in going to multiple databases anyway. With the partioned tables in 2005, you can span your data on multiple disks.

Greetz,

Geert

Geert Verhoeven
Consultant @. Ausy Belgium

My Personal Blog

|||

Hi Geert Verhoeven

Thank you for reply.

I use one storage Raid-5 for database storage composed of of 8 disk*73GB . In that case ,can that fullfill "span data on multiple disks".

Is there overhead for table partition compared to multi databases.

Just i want to know the side effect before starting merging data in one database using partitioned tables.

thanks

|||

Hi,

Indeed since you are using Raid, the spanning multiple disks is not an argument. Partioned tables can be processed by different processors but that is the same for multiple databases.

I still think that multiple databases give you more overhead then remaining in one database but it is hard to tell. Either way, I don't think that partitioned tables will be slower than multiple databases. Partitioned tables are easier to manage then multiple databases.

Greetz,

Geert

Geert Verhoeven
Consultant @. Ausy Belgium

My Personal Blog

|||

Since you have 40 different databases, I assume you want to be able to backup a portion (i.e. database in this case) and also that your data for one city does not interact with data in another city. With table partitioning, you can get the same convenience. you can partition by the city. You can possibly put each partition in its own file group there by mapped to diiferentg disk, you can backup/restore at filegroup granularity. Since partitioned table is managed as one logical unit, you won't need to worry about making schema changes in 40 databases, for example if you want to create an index.

sql

Multi Controller

For large databases backup the databases in to multiple backup devices
spanned across multiple disk controllers.
This will create multiple threads during backup right...
what is the command like let's assume we have three controller C: D: E:
the backup command we can write like
backup database DBName to disk = c:\DBDirectory
How can I take the backup into the multiple backup devices on the spot.
Thanks
Hi,
1. Create seperate Backup devices pointing to each controllers using
sp_addumpdevice system stored procedure.
2. Backup the database using Backup database command mentioning all the
devices
Backup database <dbname> to db1_control1,db1_control2 with Init
with init option will overwrite the backup files
Thanks
Hari
SQL Server MVP
"Rogers" <Rogers@.discussions.microsoft.com> wrote in message
news:19D4728B-E399-4E14-AE78-213371431378@.microsoft.com...
> For large databases backup the databases in to multiple backup devices
> spanned across multiple disk controllers.
> This will create multiple threads during backup right...
> what is the command like let's assume we have three controller C: D: E:
> the backup command we can write like
> backup database DBName to disk = c:\DBDirectory
> How can I take the backup into the multiple backup devices on the spot.
> Thanks
|||Just a note that you don't need dump devices to backup to multiple files.
You can specify the filename directly as well.
Andrew J. Kelly SQL MVP
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:OR1YS4qOFHA.2748@.TK2MSFTNGP09.phx.gbl...
> Hi,
> 1. Create seperate Backup devices pointing to each controllers using
> sp_addumpdevice system stored procedure.
> 2. Backup the database using Backup database command mentioning all the
> devices
> Backup database <dbname> to db1_control1,db1_control2 with Init
> with init option will overwrite the backup files
> Thanks
> Hari
> SQL Server MVP
>
> "Rogers" <Rogers@.discussions.microsoft.com> wrote in message
> news:19D4728B-E399-4E14-AE78-213371431378@.microsoft.com...
>
|||Backup database <dbname> to db1_control1,db1_control2 with Init
Is that means that the same backup will take place into two cotroller or
partially one and partially into another.
"Hari Prasad" wrote:

> Hi,
> 1. Create seperate Backup devices pointing to each controllers using
> sp_addumpdevice system stored procedure.
> 2. Backup the database using Backup database command mentioning all the
> devices
> Backup database <dbname> to db1_control1,db1_control2 with Init
> with init option will overwrite the backup files
> Thanks
> Hari
> SQL Server MVP
>
> "Rogers" <Rogers@.discussions.microsoft.com> wrote in message
> news:19D4728B-E399-4E14-AE78-213371431378@.microsoft.com...
>
>
|||Hi,
Partiall backup files will be send to each drives specified in Backup
database command
Thanks
Hari
SQL Server MVP
"Rogers" <Rogers@.discussions.microsoft.com> wrote in message
news:F17B751D-4C3D-4D1B-8294-508C4286E333@.microsoft.com...[vbcol=seagreen]
> Backup database <dbname> to db1_control1,db1_control2 with Init
> Is that means that the same backup will take place into two cotroller or
> partially one and partially into another.
>
> "Hari Prasad" wrote:
|||Thanks HARI.
"Hari Prasad" wrote:

> Hi,
> Partiall backup files will be send to each drives specified in Backup
> database command
> Thanks
> Hari
> SQL Server MVP
> "Rogers" <Rogers@.discussions.microsoft.com> wrote in message
> news:F17B751D-4C3D-4D1B-8294-508C4286E333@.microsoft.com...
>
>

Monday, February 20, 2012

MsSql Server 2000 Backup to tape

i have 3 schedule job for backing up different databases (4 database) to a
tape drive.
first job is to do database backup.
2nd job is to backup different database.
3rd job is to backup Transaction log database.
each job consist of 4 step, which each step is for each database
when schedule sometimes i get the message The file on device '\\.\Tape0' is
not a valid Microsoft Tape Format backup st.[Sqlstate 42000])error 3242)
Backup database is terminating abnormally. [ Sqlstate 42000](error 3013)
. the
step fail
but sometime it can go thru the job.
Please Help. Thanks
EHTanHi
Have you thought of changing to backing up to disc and then to tape?
John
"EngHim" wrote:

> i have 3 schedule job for backing up different databases (4 database) to a
> tape drive.
> first job is to do database backup.
> 2nd job is to backup different database.
> 3rd job is to backup Transaction log database.
> each job consist of 4 step, which each step is for each database
> when schedule sometimes i get the message The file on device '\\.\Tape0' i
s
> not a valid Microsoft Tape Format backup st.[Sqlstate 42000])error 324
2)
> Backup database is terminating abnormally. [ Sqlstate 42000](error 301
3). the
> step fail
> but sometime it can go thru the job.
> Please Help. Thanks
> --
> EHTan

MsSql Server 2000 Backup to tape

i have 3 schedule job for backing up different databases (4 database) to a
tape drive.
first job is to do database backup.
2nd job is to backup different database.
3rd job is to backup Transaction log database.
each job consist of 4 step, which each step is for each database
when schedule sometimes i get the message The file on device '\\.\Tape0' is
not a valid Microsoft Tape Format backup st.[Sqlstate 42000])error 3242)
Backup database is terminating abnormally. [ Sqlstate 42000](error 3013). the
step fail
but sometime it can go thru the job.
Please Help. Thanks
--
EHTanHi
Have you thought of changing to backing up to disc and then to tape?
John
"EngHim" wrote:
> i have 3 schedule job for backing up different databases (4 database) to a
> tape drive.
> first job is to do database backup.
> 2nd job is to backup different database.
> 3rd job is to backup Transaction log database.
> each job consist of 4 step, which each step is for each database
> when schedule sometimes i get the message The file on device '\\.\Tape0' is
> not a valid Microsoft Tape Format backup st.[Sqlstate 42000])error 3242)
> Backup database is terminating abnormally. [ Sqlstate 42000](error 3013). the
> step fail
> but sometime it can go thru the job.
> Please Help. Thanks
> --
> EHTan