Write Only Database

Jul 23, 2005

Hi,
Is there a way to make a database write only, like in SQL server you
can make a DB read only? There is sensitive data which we want dont
want to read.
What other alternatives can anyone think?
Thanks.

View 4 Replies


ADVERTISEMENT

How To Write To Mssql Database

Oct 23, 2006

I am very new to asp.net. I really mainly use PHP but want to migrate to asp.net, but it doesn't seem that easy.I am creating a page for peson to pay a subscription page where they will enter personal information an credit card information.I created the form for this with validation controls.I don't know however how to write the form data to the mssql database.I am using mssql 2005, but i would need a work out for the 2000 version as well.

View 1 Replies View Related

Write All Transactions In The Log To The Database

Jun 26, 2000

Hi
All,
I would like to know write all transcations in the log file to the
database with out doing full backup of the database..
Please let me know is there any dbcc statement or some other method to do this..

Thanks A lot,
VJ

View 1 Replies View Related

Can't Write To Database After Express SP2

Jan 9, 2008

I have a lot of databases under SQL Server Express 2005, reading an writing datas with VB6 (yes Visual Basic 6) and ADO (Provider SQLOLEDB). I do NOT install the SP2, but yesterday I install Silverlight and now I have SP2 on my SQL Server (9.0.3042) !?

Now I have a strange problem: I can read all datas, but I can't write any data to any tables.

Here a simple example:


I have a table "Professions", one column "RecNo" as int identity (1,1) with primary key and a column "Profession" as nvarchar(30).


Reading like this works:

Dim rcs As New Recordset

sTmp = "select * from Professions order by Profession"
rcs.Open sTmp, gcn, adOpenForwardOnly, adLockReadOnly
If rcs.RecordCount > 0 Then
Do
...
rcs.MoveNext
Loop Until rcs.EOF
End If
rcs.Close

Writing like this doesn't work anymore:

Dim lNewRecNo as long
Dim rcs As New Recordset

sTmp = "select * from Professions where RecNo = 42"
rcs.Open sTmp, gcn, adOpenKeyset, adLockOptimistic
If rcs.RecordCount < 1 Then rcs.AddNew
rcs!Profession = "XYZ"
rcs.Update
lNewRecNo = CNull2Val(rcs!RecNo)
rcs.Close


The rcs-object still give me the new record number after rcs.update, but the record is not in the database table. Adding a record in the Management Studio gives an error "row failed on retrieve on last operation". If I then click the button "Execute SQL" the new record is shown.
Another behaviour: Adding a row in the IDE like described above locks the Management Studio. From where I recieve a time out error then click the button "Execute SQL".
Any ideas whats wrong ?

View 1 Replies View Related

ADO Write Not Commiting To Database

Sep 6, 2007

This seems about the best place for my query however it does cross over a bit ... dont shoot me.

SQL 2000 sp4 on server 2003
dev env VB6
users XP Sp2
Mdac 2.8

I have a legacy app that required some simple ammendment, insert a single row of data into a simple table (Not rocket Science) Sample : insert into maintcon_mach (maintcon_id, mach_id, date) values (123, 456, getdate())

PK on maintcon_id, mach_id so that single relationship exists between maintcon_id and mach_id in the table.

The procedure above is followed by a verification procedure that checks to see if table maintcon_mach has a mach_id 456 against maintcon_id 123, this procedure returns true. So far so good, however if you step through the procedure till disconnecting from the database and then reconnect and do only the verification again, the data is missing.

The following steps to resolve have resulted in no improvement.

1. Verify MDAC in entire project and on users computers all 2.8
2 Remove transactions (just in case) and still the same.
3 Replace SQL insert with ADO (As below) and still the same.. tried this with and without transactions.
4 Tried referecing older MDACs
5 Installed SQLredist on sample machines and still the same.


rs.Open "maintcon_mach", conMach, adOpenForwardOnly, adLockOptimistic
With rs
.AddNew
!maintcon_id = lngmaint
!mach_id = lngMachID
!Date = Format(Now(), "yyyy-mm-dd")
.Update
End With

Is the problem in SQL or MDAC???
Perhaps I've missed something (Obviously have) but have run out of places to look... Any idea's

In advance ...thanx

View 3 Replies View Related

Write Excel Data To MS SQL Database

Dec 22, 2003

Dear expert, please show me some examples of how I can update an Microsoft SQL table data with an excel sheet. Meaning, when I upload an excel sheet using an ASPX page the data in the excel sheet will be transfer to a particular table in the database. Thank you in advance.

View 2 Replies View Related

Write Data Into Database From A Session?

Oct 8, 2005

I'm trying to write data from a session into database but it won't work.
Could someone help me what is wrong with this.

cobjDT = Session("cart")
For each cobjDR in cobjDT.rows
 Dim cmdInsert2 as New SQLCommand("order_details", loConn)
             cmdInsert2.CommandType = CommandType.StoredProcedure
            
cmdInsert2.Parameters.Add(New SqlParameter("@Orders", SqlDbType.int, 4,
"OrderID"))
            
cmdInsert2.Parameters("@Orders").Value = Request("OrderIDtext")
            
cmdInsert2.Parameters.Add(New SqlParameter("@PID", SqlDbType.int, 4,
"PID"))
            
cmdInsert2.Parameters("@PID").Value = Request(cobjDR("PID"))
            
cmdInsert2.Parameters.Add(New SqlParameter("@PakID", SqlDbType.int, 4,
"PakID"))
            
cmdInsert2.Parameters("@PakID").Value = Request(cobjDR("PAKID"))
            
cmdInsert2.Parameters.Add(New SqlParameter("@StyckPris",
SqlDbType.decimal, 9, "StyckPris"))
            
cmdInsert2.Parameters("@StyckPris").Value = Request(cobjDR("StyckPris"))
            
cmdInsert2.Parameters.Add(New SqlParameter("@Mangd", SqlDbType.int, 4,
"Mangd"))
            
cmdInsert2.Parameters("@Mangd").Value = Request(cobjDR("Quantity"))
             loConn.Open()
             cmdInsert2.ExecuteNonQuery()
             loConn.Close()
next            

When I execute this an error message comes

Server Error in '/examen' Application.

Input string was not in a correct format.



Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:




Line 78: cmdInsert2.Parameters("@Mangd").Value = Request(cobjDR("Quantity"))Line 79: loConn.Open()Line 80: cmdInsert2.ExecuteNonQuery()Line 81: loConn.Close()Line 82: next







Source File: D:lofa.mine.nuexamenmembersTMP3thkwo1d0w.aspx    Line: 80


Stack Trace:




[FormatException: Input string was not in a correct format.] System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +194 ASP.TMP3thkwo1d0w_aspx.Page_Load(Object Sender, EventArgs E) in D:lofa.mine.nuexamenmembersTMP3thkwo1d0w.aspx:80 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731









Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

I use same character types in storedProcedure what they are in the
database and when I call the SP on my page the char types are same as
they are in the SP

I don't see what the problem is. Please Help

View 1 Replies View Related

Write In Database During DataReader Loop.

Mar 16, 2006

Hello,
I want to insert a value in a database table during a datareader loop. But I get an error saying that the connection (MyConnection) is already open. This is normal because it is open for processing the datareader loop. But how do I solve this? I just want to write a value for logging the process.
This is my code:
Dim iID as Integer = 1
Dim strSQLNewsLetter As String = "SELECT * FROM Members WHERE Members.Enabled=1"Dim MyCommand=New MySqlCommand(strSQLNewsLetter, MyConnection)MyConnection.Open()Dim myReader as MySQLDataReader myReader = MyCommand.ExecuteReader() While myReader.Read() If MyReader.GetMySqlDateTime(3).ToString() = "0/00/0000 0:00:00" then  WriteMyLog(iID, MyReader.GetInt32(0)) End IfEnd While myReader.Close()myConnection.Close()
Function WriteMyLog(iID as Integer, iMemberID as Integer) 'Write Log after Newsletter has been sent  Dim strSqlLog as String 'Create query  strSqlLog = "INSERT INTO NewsLetterStats (ID, MemberID, TimeSent) VALUES ("  strSqlLog &= "" & iID & "," 'NewsLetterID  strSqlLog &= "" & iMemberID & "," 'MemberID  strSqlLog &= "'" & MySQLTimeStamp() & "')" 'Timestamp   Dim MyCmdLogNews As New MySqlCommand(strSqlLog, myConnection)  MyCmdLogNews.Connection.Open()  MyCmdLogNews.ExecuteNonQuery()  MyCmdLogNews.Connection.Close()End Function

View 9 Replies View Related

How To Write Script To Update The Database?

Apr 30, 2004

Hi folks,
Do you guys know how to write the Script to update the SQL database? please help me out? For example, the script will update SQL database at 1:00 am every day...some like that?

Thanks,
Vu

View 4 Replies View Related

How To Write Query In Vwd2005 To Connect To Database?

Jan 31, 2008

can anyone help me here/i want to write connect to my sqldatabase and then perform insert query ,select query, update query from my default.aspx.cs file.but i dont know how to do this.can anyone explain me this in detail.?i want to my data in my webform in the sqldatabase, select it , and update it.how can i do this writing a code in c#.? plz explain in detail.i m using vwd2005 express and sql express.thanks.     

View 1 Replies View Related

Should I Add Lock Statements To My Database Write Querys

Jun 5, 2008

Hello,Could some clarify for me? I’ve been told that I should add  lock statements  to my database write querys (update, delete, insert). I’m not sure If it’s necessary though. The only documentation I’ve found so far is how to implement a lock statement with threading but I’m not using the threading namespace. What best practice and how would I implement this without threading or should I be using threading?Thanks in advance!
 

View 4 Replies View Related

How To Write Portable Database Access Code?

Jul 20, 2005

I can access Microsoft Access database via ODBC on Windows 2000 usingC++. Now, I would like to use the SAME piece of code to access MS SQLon Windows. Can I achieve this without any modification to my existingcodes?Then, I would like to use the SAME piece of codes to access Oracleon Windows? Is it possible?Thanks in advance!

View 1 Replies View Related

Transact SQL :: How To Write Query From Two Different Database Engines

Jul 13, 2015

Is it possible to write query from different database engines?

One database A is in local server database engine and another database B is in  another server located in different system.

Now , I need to write a query in database A  based on table A and table B (another database engine).

View 2 Replies View Related

Added A Column To My SQL Database And Now Text Field Will Not Write To It. Why???

Aug 28, 2006

I have a web form that is an interface for a database.  The code was working fine until a field needed to be added.  So I added the new field, updated the data adapter and data set, and when i enter the data into the field, all of the old fields are getting updated, but the new ones aren't.  I am at wits end as to why.  Can someone please help!!! I am using VS Studio 2000 ASP.NET and C#.  The code is below.  The bold items are the new fields.using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;namespace TrafficDept{/// <summary>/// Summary description for AddOwner./// </summary>public class AddOwner : System.Web.UI.Page{protected System.Web.UI.WebControls.Button Button1;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;protected System.Data.SqlClient.SqlConnection sqlConnection1;protected System.Web.UI.WebControls.TextBox TextBox1;protected System.Web.UI.WebControls.TextBox TextBox2;protected System.Data.SqlClient.SqlDataAdapter daAddOwner;protected System.Web.UI.WebControls.TextBox tbOtherOwnerLName;protected System.Web.UI.WebControls.Panel namePanel;protected System.Web.UI.WebControls.TextBox tbOtherOwnerMI;protected System.Web.UI.WebControls.TextBox tbOtherOwnerFName;protected System.Web.UI.WebControls.TextBox tbSecondOwnerLName;protected System.Web.UI.WebControls.TextBox tbSecondOwnerMI;protected System.Web.UI.WebControls.TextBox tbSecondOwnerFName;protected System.Web.UI.WebControls.Button Button4;protected SiteCubed.EditWorksProfessional tbNote;protected System.Web.UI.WebControls.Panel notePanel;protected System.Web.UI.WebControls.DropDownList ddlStatus;protected PeterBlum.PetersDatePackage.DateTextBox tbRegDate;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;protected System.Web.UI.WebControls.TextBox tbOwner;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;protected System.Web.UI.WebControls.TextBox tbOwnerMI;protected System.Web.UI.WebControls.TextBox tbOwnerLName;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;protected System.Web.UI.WebControls.TextBox tbBusinessName;protected System.Web.UI.WebControls.TextBox tbAddress;protected System.Web.UI.WebControls.TextBox tbRegNo;protected System.Web.UI.WebControls.TextBox tbPreviousOwner;protected System.Web.UI.WebControls.TextBox tbPOwnerAddress;protected System.Web.UI.WebControls.TextBox tbPORegNo;protected PeterBlum.PetersDatePackage.DateTextBox tbTransferDate;protected System.Web.UI.WebControls.DropDownList ddlMeans;protected System.Web.UI.WebControls.Button Button3;protected System.Web.UI.WebControls.Button Button2;protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;protected TrafficDept.dsAddOwner dsAddOwner1;  private void Page_Load(object sender, System.EventArgs e){// Put user code to initialize the page here}#region Web Form Designer generated codeprivate void Button2_Click(object sender, System.EventArgs e){Response.Redirect("AddOthers.aspx");}private void Button1_Click(object sender, System.EventArgs e){daAddOwner.Fill(dsAddOwner1);dsAddOwner.OwnershipRow drOwner = dsAddOwner1.Ownership.NewOwnershipRow();drOwner.Plates_ID = int.Parse(Session["PlatesID"].ToString());drOwner.Status = ddlStatus.SelectedItem.Text;drOwner.Current_Legal_Owner = tbOwner.Text;drOwner.Owner_CurrentLegalOwnerMI = tbOwnerMI.Text.ToString();drOwner.Owner_CurrentLegalOwnerLName = tbOwnerLName.Text;drOwner.Owner_CurrentBusinessName = tbBusinessName.Text;if (!tbRegDate.xIsEmpty)drOwner.Date_of_Registration = DateTime.Parse(tbRegDate.Text.ToString());drOwner.Address_of_Current_Owner = tbAddress.Text;drOwner.Reg_No_for_Current_Owner = tbRegNo.Text;drOwner.Previous_Owner = tbPreviousOwner.Text;drOwner.Previous_Owner_Address = tbPOwnerAddress.Text;drOwner.Reg_No_for_Previous_Owner = tbPORegNo.Text;if (!tbTransferDate.xIsEmpty)drOwner.Date_of_Transfer = DateTime.Parse(tbTransferDate.Text.ToString());drOwner.By_Means_of = ddlMeans.SelectedItem.Text;drOwner.Owner_SecondaryLegalOwnerFName = tbSecondOwnerFName.Text;drOwner.Owner_SecondaryLegalOwnerMI = tbSecondOwnerMI.Text;drOwner.Owner_SecondaryLegalOwnerLName = tbSecondOwnerLName.Text;drOwner.Owner_OtherLegalOwnerFName = tbOtherOwnerFName.Text;drOwner.Owner_OtherLegalOwnerMI = tbOtherOwnerMI.Text;drOwner.Owner_OtherLegalOwnerLName = tbOtherOwnerLName.Text;drOwner.Owner_Notes = tbNote.Text;dsAddOwner1.Ownership.Rows.Add(drOwner);daAddOwner.Update(dsAddOwner1);Response.Redirect("AddOthersTP.aspx");}private void Button3_Click(object sender, System.EventArgs e){//daAddOwner.Fill(dsAddOwner1);//dsAddOwner.OwnershipRow drAddOwner = dsAddOwner1.Ownership.NewOwnershipRow();namePanel.Visible = true; }private void Button4_Click(object sender, System.EventArgs e){notePanel.Visible = true;}}}

View 1 Replies View Related

How To Write Database Scripts Using Sql Server Managment Studio

Apr 25, 2008

Hello All,
My boss told me that we can write migration scripts to database using Sql server management studio. can someone guide me or point to a website which explains in detail how to do this please. i want to learn this. or even a tutorial also would be great. i am interested in writing or executing scripts by using sql server management studio( in sql server 2005). i think its called sql enterprise manager in sql server 2000.
Thanks a lot.

View 5 Replies View Related

Application Locks Up When Trying To Write To Db After A Replication Where I Create The Database.

Jan 3, 2008

Hello all,

When I create a new database and replicate to it using BeginMonitoredBackgroundSync :







Code Block

public void BeginMonitoredBackgroundSync(string User)
{
CreateReplicationInstance(User);
repl.BeginSynchronize(
OnSimplifiedSynchronizeComplete,
SqlCeReplication_OnStartTableUpload,
SqlCeReplication_OnStartTableDownload,
SqlCeReplication_OnSynchronization,
repl);
}




private void CreateReplicationInstance(string User)
{
repl = new SqlCeReplication();
string host = repl.HostName;
repl.HostName = User;
string dbFilePath = "";


dbFilePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) +
"\" + repl.HostName + ".sdf";
string myConnectionString = string.Format("Data Source = {0};PWD = {1}", dbFilePath, sqlSettings.Items["SqlPassword"]);

repl.InternetUrl = dynamicsReplicationSettings.ReplicationSettingsItems["InternetUrl"];
repl.PublisherSecurityMode = SecurityType.DBAuthentication;
repl.Publisher = dynamicsReplicationSettings.ReplicationSettingsItems["Publisher"];
repl.PublisherDatabase = dynamicsReplicationSettings.ReplicationSettingsItems["PublisherDatabase"];
repl.PublisherLogin = dynamicsReplicationSettings.ReplicationSettingsItems["PublisherLogin"];
repl.PublisherPassword = dynamicsReplicationSettings.ReplicationSettingsItems["PublisherPassword"];
repl.Publication = dynamicsReplicationSettings.ReplicationSettingsItems["Publication"];

repl.Subscriber = "RemoteSubscription" + repl.HostName;
repl.SubscriberConnectionString = myConnectionString;

repl.ConnectionRetryTimeout = 120;
repl.LoginTimeout = 120;
repl.CompressionLevel = 6;

if (File.Exists(dbFilePath))
{
FileInfo info = new FileInfo(dbFilePath);
if (info.Length <= 20480)
{
File.Delete(dbFilePath);
repl.AddSubscription(System.Data.SqlServerCe.AddOption.CreateDatabase);
}
}
else
{
repl.AddSubscription(System.Data.SqlServerCe.AddOption.CreateDatabase);
}

primeConnection();

}
After the replication finishes, I dispose the replication object like so:





Code Block

void OnAsyncSynchronizeComplete(IAsyncResult asyncResult)
{

try
{
repl.EndSynchronize(asyncResult);
if (repl != null)
{
repl.Dispose();
repl = null;

}
if (ReplicationComplete != null) ReplicationComplete(this, true);
}
catch(Exception ex)
{
if (ReplicationComplete != null) ReplicationComplete(ex, false);
}

}

Then later, if I try to update, insert or delete to the database, the application will hang. I can read from it, but I cannot write. If I close the application down and open it back up without replicating, I will not get any lockups. It also will not hang up after any replications prior to the create replication. I think I am doing something wrong in the initial replication that is holding on to some connection to the DB causing it to lock up. Has anyone seen anything like this before?

View 1 Replies View Related

Way To Determine Which Logins Have Write Permissions To Database On Sever

Nov 15, 2007

Hi there,

Does anyone know a way (a query perhaps?) to determine which logins have write permissions to a specific database on SQL Server 2005? Ive thought about joining sys.syslogins & sys.sysusers but looking at the columns, not sure which one would render me that info.

Any help is appreciated. Many thanks!

View 1 Replies View Related

Sql Server Express Loses Ability To Write To Database

Jun 17, 2006

After a period of use (typically 1-2 hours), an application using SQL Server Express stops writing to the database, whilst still continuing to read from it. As far as I can tell, no error message is generated by any operation. The application is written in VB Express and is executed on several machines, with SQL Server Express on a central machine. Re-starting the application on the affected machine restores normal operation.

The problem on one machine does not cause a similar problem elsewhere at the same time (hence it appears to be an issue with the relationship between the application and SQL Server)

This does not appear to relate to the response to Q asked by sgcook on 9 may as we are not using user instances, but only a bare minimum connection string.

View 15 Replies View Related

HELP To Write Stored Procedure Whose Values Are Calculated Automatically In Database

May 12, 2007

 Hi frdz,    I m creating my web-application in asp.net with C# 2005 and using sql server 2005.    I have created the stored procedure for the insert,update.    I want to know how to write the mathematical calculations in the stored procedure..    Pls tell me from the below  stored procedure  were i m making the mistake  ??    As the discount and the total amount are not calculated by itself....and stored in the database   How to convert the @discpercent numeric(5,2) to@discpercent ="NoDiscount" should be displayed when no discount is being given to the customers....     ALTER PROCEDURE CalculationStoredProcedure

@accountid int output,
@accountname varchar(20),
@opbal numeric(10, 2),
@opbalcode char(2),
@total numeric(10, 2),
@clbal numeric(10, 2),
@clbalcode char(2),
@discpercent numeric(5,2),
@discamt numeric(10, 2)


as


begin
set nocount on



if @opbal IS NULL OR @opbal = 0

begin
select @opbal=0
select @opbalcode= ' '
select @clbal= 0
select @total= 0
select @clbalcode= ' '
@discpercent ="NoDiscount"
@discamt=0
end




select @accountid = isnull(max(accountid),0) + 1 from accountmaster



select @total=@opbal - @clbal from accountmaster
select @discamt=@total* @discpercent/100 from accountmaster

begin
insert into accountmaster
(
accountname,opbal,opbalcode,clbal,clbalcode

)
values
(
@accountname,@opbal,@opbalcode,@clbal,@clbalcode
)

end

set nocount off
end

      Thanxs in adv... 

View 7 Replies View Related

SQL Server 2012 :: Determine Read / Write Frequency On Database Table

Oct 6, 2015

How do I determine the read/write frequency on a database table? I am trying to do this on a 2012 and 2008 R2 servers.

View 2 Replies View Related

Concurrency Issue On A Single Database User For An Online Read/write Application

Aug 3, 2006

Hi to all DBAs,

I would like to ask if there will be a write and concurrency issue if i would create an online application with just one user connecting to the database, just like most open source php/mysql that can be downloaded

i.e
Setup 1. I will grant a single user that will connect to a database and will be set to a config.inc.php file and then create a table users (userid, username, password) and this table will be used for the application authentication and access control.

Setup 2. or is it much better to grant users that will connect to the database and have the table users for access control of the application?

to further illustrate my query:

Setup 1 would be:
###################Table: Users
user a@ipadd --> db1 --> userid mary --> myOnlineApp
user a@ipadd --> db1 --> userid john --> myOnlineApp
user a@ipadd --> db1 --> userid paul --> myOnlineApp


and Setup 2 would be:
#####################Table: Users
user mary@ipadd --> db1 --> userid mary --> myOnlineApp
user john@ipadd --> db1 --> userid john --> myOnlineApp
user paul@ipadd --> db1 --> userid paul --> myOnlineApp

will Setup 1 be enough if I will use SQL Server as database?

or Setup 2 is better user/database architecture?

This application will be online enrollment for a school with 16,000 students

very much appreciated for the feedbacks and suggestions

^_^x

View 3 Replies View Related

SQL 2012 :: Blank Database Created On Two Separate Disks - Write To Multiple Files

Mar 17, 2014

I am testing out a blank database created over two physical files on two separate disks with one table called data which has one column called values nvarchar(max).

I filled the table up with a whole load of data and ran a select * against it. If I run Permon at the same time I can see that the read load has been spread over multiple disks as each of these disks is getting read from in parallel. If I create the same database on a single file and run the same select * again it takes much longer, proving that the read load has been distributed across multiple disks.

Now moving onto writes, this is where the confusion lies. I understand that SQL server fills files evenly until they need growing, after which it will then fill files individually until they are full in a round robin fashion unless you have trace 1117 turned on. What I don't understand is why the writes aren't distributed out whilst it is filling these file groups.

I ran an continual insert into my table with go 1000000 to monitor how the files are being filled up. I monitored where SQL server was physically placing the files as they were being inserted by running the following query:

;WITH CTE AS
(SELECT
sys.fn_PhysLocFormatter (%%physloc%%) col1,
RIGHT(LEFT(sys.fn_PhysLocFormatter (%%physloc%%),2),1) AS [Physical RID],
DATAID

[Code] ....

I could see that it would a thousand or so records into file 1, then a thousand or so into file 2, then a thousand or so into file 1 etc etc. In another words it would hit one disk, then another disk, then back to disk one to fill the file evenly. Is there any way to make SQL Server distribute the writes out in parallel so that both disks are writing in tandem?

By the looks of it, multiple disks only scale reads, as with writes only one disk is ever written to at once which is annoying. Any way to harness the write power of multiple disks?

View 6 Replies View Related

Backup Master Key, Cannot Write Into File 'c: Empmaster'. Verify That You Have Write Permissions, That The File Path Is Valid.

Jul 12, 2006

Hi,



I tried to backup the master key by the following syntax :

OPEN MASTER KEY DECRYPTION BY PASSWORD = 'mypassword'

BACKUP MASTER KEY TO FILE = 'c: empmaster' ENCRYPTION BY PASSWORD = 'mypassword'

but it failed and i got the following message:

Cannot write into file 'c: empmaster'. Verify that you have write permissions, that the file path is valid, and that the file does not already exist.

NB: I am using the "sa" user to execute this command.

I know that we have a security permission issue , but where and how ?



Regards,

Tarek Ghazali

SQL Server MVP

View 12 Replies View Related

SQL 2000 Reovery Fails Sometimes. Error Code (Error 3136). How To Make Database Write Mode?

Jan 7, 2008

Hello,

I am applying hourly differential backup to the backup server from production with the following command. This command makes the database on standby server into read only mode.


RESTORE DATABASE ARSYSTEM FROM DISK = 'E:SQL backup from productionsql_full_backup'
WITH MOVE 'arsystem' TO
'd:ardataarsystem.mdf' ,
MOVE 'arsystem_log' TO 'D:ARLOGARsystem' ,
STANDBY = 'E:SQL backup from productionSQL daily diff back up'


Now I want to run a command which will put the database in write mode. I have created a job which would make the datbase Write mode. This job runs successfully sometimes and fails sometimes. I need to ensure that the job always succeeds. When it fails, how do I troubleshoot and what is the possible fix?

Thanks in advance.

The error message is

Cannot apply the backup on device 'E:SQL backup from productionSQL daily diff back up' to database 'ARSYSTEM'. [SQLSTATE 42000] (Error 3136) RESTORE DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.


The steps for the job are as follows with the failing step highlighted in bold.


copy /y "\172.31.9.12Remedy BackupackupSQL backupsql_full_backup" "E:SQL backup from productionsql_full_backup"

copy /y "\172.31.9.12Remedy BackupackupSQL backupSQL daily diff back up" "E:SQL backup from productionSQL daily diff back up"

xp_cmdshell 'net stop "bmc remedy action request system server"'

exec rp_kill_db_processes 'ARSYSTEM'

RESTORE DATABASE ARSYSTEM

FROM DISK = 'E:SQL backup from productionsql_full_backup'

WITH

MOVE 'arsystem' TO 'd:ardataarsystem.mdf' ,

MOVE 'arsystem_log' TO 'D:ARLOGARsystem' ,

NORECOVERY


Failing step

RESTORE DATABASE ARSYSTEM

FROM DISK = 'E:SQL backup from productionSQL daily diff back up'

WITH

MOVE 'arsystem' TO 'd:ardataarsystem.mdf' ,

MOVE 'arsystem_log' TO 'D:ARLOGARsystem' ,

RECOVERY



xp_cmdshell 'del /f "E:SQL backup from productionsql_full_backup"'

xp_cmdshell 'del /f "E:SQL backup from productionsql daily diff back up"'

xp_cmdshell 'net start "bmc remedy action request system server"'





I have scheduled the following hourly diffential restore job too which never fails.

RESTORE DATABASE ARSYSTEM FROM DISK = 'E:SQL backup from productionsql_full_backup'
WITH MOVE 'arsystem' TO
'd:ardataarsystem.mdf' ,
MOVE 'arsystem_log' TO 'D:ARLOGARsystem' ,
STANDBY = 'E:SQL backup from productionSQL daily diff back up'
EXEC MASTER..XP_CMDSHELL 'del /f "E:SQL backup from productionSQL daily diff back up"'

View 12 Replies View Related

Batch File - Read From One Table And Write To Another Database And Table

Nov 17, 2011

Any easy way for a batch file or automated process to read from one db and table and what ever entry is missing out of another database + table it writes those missing entries to.

This is a simple table in one db that is filled with usernames, I want to see if there are missing usernames in another db and table and write those entries.

db1.usr_table.usr_name = jdoenew
If jdoenew is missing in the 2nd db I will need to write entries like:
db1.usr_table.usr_name = jdoenew
db1.usr_table.password = tmppassword
db1.usr_table.active = 1

View 1 Replies View Related

Transact SQL :: Making Server Database Read / Write From Read Only

Jan 12, 2012

i attached adventure works in sql server 2008 and it showing as read only ,make it read write or remove read only tag from database.

View 11 Replies View Related

Reset Database Files From Read-only To Read-write

Jan 18, 2008

I have two database files, one .mdf and one .ndf. The creator of these files has marked them readonly. I want to "attach" these files to a new database, but cannot do so because they are read-only. I get this message:

Server: Msg 3415, Level 16, State 2, Line 1
Database 'TestSprintLD2' is read-only or has read-only files and must be made writable before it can be upgraded.

What command(s) are needed to make these files read_write?

thanks

View 7 Replies View Related

How To Write This SQL

Jul 27, 2006

I have a table T1
ID Desc
1 aaaa
1 bbbb
1 cccc
2 aaaa
2 cccc
3 cccc
 
Now, I need to group by ID and make Desc column as follows in a new table
ID Desc
1 aaaa, bbbb, cccc
2 aaaa, cccc
3 cccc
 
How can I do this?
 

View 2 Replies View Related

How To Write This Sql

Jul 28, 2006

I have table T1 with fields T1.ID, T1.CheckBoxCol
 
The T2 tabel has the same ID as T2.ID and T2.CheckBox1, T2.CheckBox2, T2. CheckBox3
 
Now, I need to check T1 and
if T1.CheckBoxCol=1 then set T2.CheckBox1=1
else if T1.CheckBoxCol=2 then set T2.CheckBox2=1
else if T1.CheckBoxCol=3 then set T2.CheckBox3=1
 
for each T1.ID
 
How can I do this?
 

View 2 Replies View Related

How To Write This

Jan 1, 2007

Hello,
I have MyTable with ID, IsYesNo fields
ID is duplicated so I need perform select on MyTable with the following conditions:
1. Select all the ID distinct where IsYesNo=’Yes’ first
2. Then select all the ID distinct where IsYesNo=’No’ if ID is not in the first selection
Combine these two and return the result
 

View 1 Replies View Related

How To Write To SQL

Apr 29, 2007

I'm sure this is really basic. I've created a simple form that on submittal, I would like the text boxes to be submitted to the database. I have successfully created the Datasource and it connects ok, but what code would i use to submit one text box for email address and a simple submit button. Is there an easy way to do this with VWDE?
 Thanks

View 5 Replies View Related

Need Help To Write SQL

Aug 29, 2007

Hi,I
have a hotel reservation system.I need to implement Check availability
(Room checking) function for the project.But I dont understand how do I
start and write SQL for this.Here is table structureTblRooms------------RoomsIDRoomNameNoteunitPriceSeasonalOffersTblReservation----------------ReservationIDArrivalDateDepartureDateArrivalFromFlightNoPurposeOfVisitTblRoomsInventory-------------------RoomsInventoryIDTotalRoomsBookedRooms Should I add more fields or table to implement this or this is enough .please any body can help me 

View 2 Replies View Related

How To Write This SQL

Sep 14, 2007

 How to write this SQLSelectCommand="SELECT DISTINCT TblOrder.CustomerUID, TblOrder.OrderHiddenID, TblPayment.PaymentAmount, TblPayment.Result, TblOrder.OrderID FROM TblOrder CROSS JOIN TblPayment WHERE (TblOrder.CustomerUID = @IsCustomerID) AND (TblOrder.OrderHiddenID = @IsHiddenID) AND (TblPayment.Result = 'Pending')"How to get latest order id from this.I need to combine it with above sql.I mean i want to select above records but based on max orderid record.such as select latest records from ....above SQL where max orderid

View 2 Replies View Related







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