[how to] SQL Server 2008 : Best practice to reorganize/ rebuild index by automation |
- SQL Server 2008 : Best practice to reorganize/ rebuild index by automation
- SQL Server 2008/R2 Backup and restore job script
- SQL server migration from 2000 to 2008/R2
- Best method to copy a database from one instance to another
- Query to find GUID's "not in" null containing subquery returns no results
- Get result of joining multiple tables as one row
- Optimize Query of Count Less Than
- Problems migrate database from 4 to 5.5 mysql
- Unable to drop non-PK index because it is referenced in a foreign key constraint
- Optimize simple query using ORDER BY date and text
- Mysql Fragmentation. How bad is too bad?
- How big should I make a column in an audit table for storing the output of COLUMNS_UPDATED()?
- Deleting users need delete procedures [on hold]
- mysql replication for certain dababases
- Replication is missing a specific set of rows on subscriber
- How can I find the not used numbers in a column?
- What are the ports and directionality of the TCP connections used in MySQL replication?
- Trace flag and which need to be turned off and Why
- Streaming Replication Resource Management (PGSQL) on FreeBSD 8.x
- Mysql foreign key cascade delete
- Geohash implementation in PostgreSQL
- SQL Server 2012 Express fails at repair install, produces error 5178
- MySQL row does not persist, but primary key with auto-increment is incremented
- Fixing wildcard expansion resulting in too many terms error (DRG-51030)
- export (mysqldump) databases from MySQL version 4.0?
- Dropping Hypothetical Indexes
- Avoiding performance hit from GROUP BY during FULLTEXT search?
- AWS performance of RDS with provisioned IOPS vs EC2
- sp_startpublication_snapshot Parameter(s)
SQL Server 2008 : Best practice to reorganize/ rebuild index by automation Posted: 23 Aug 2013 08:48 PM PDT In SQL Server 2008, Describe Best practice to reorganize/ rebuild index by automation ? |
SQL Server 2008/R2 Backup and restore job script Posted: 23 Aug 2013 08:03 PM PDT Is any store procedure or script there for single or all database backup and restore job? |
SQL server migration from 2000 to 2008/R2 Posted: 23 Aug 2013 07:53 PM PDT Need to learn step by step of migration from SQL Server 2000/2005 to 2008/R2 including what are the dos and don'ts. Thanks |
Best method to copy a database from one instance to another Posted: 23 Aug 2013 08:55 PM PDT What is the best method to move/copy a database from production to test (and test to production) including all objects/jobs/logins and data? |
Query to find GUID's "not in" null containing subquery returns no results Posted: 23 Aug 2013 06:58 PM PDT When I have a query that checks if a column of type I know I can just do a Query Example:
Working Test:
Broken Test:
|
Get result of joining multiple tables as one row Posted: 23 Aug 2013 05:58 PM PDT I have these 2 tables: If I want to get all the information about a user using his userid, I can simply join them using this: which for USER_ID = 1 returns: What I need is actually 1 unique row instead of multiple rows. Is it in any way possible to get something like this? (I haven't seen something to do it but am not sure) |
Optimize Query of Count Less Than Posted: 23 Aug 2013 07:02 PM PDT I would like to optimize querying in SQL Server of a table to know whether it has a count of records less than a certain amount. I don't need to know the complete count, just whether it is less than, say, 2. Would it be efficient to do something like this?... |
Problems migrate database from 4 to 5.5 mysql Posted: 23 Aug 2013 04:01 PM PDT I have a server with 4.0 mysql version innodb engine. i need to migrate to other server with 5.5 version (linux) ok i dump the full database using mysqldump, when i try to restore on the 5.5 server it has a problem, because the file generate in the 4.0 set the variable on the sql scritp TYPE=INNODB and mysql 5.5 accepts only ENGINE=INNODB format on the time table creation and it abort the process. i search on google, call any friends and nothing! the sql file has 16 gigabytes. is not possible edit with an file editor. error exemple: CREATE TABLE tabadi ( nAdicao char(3) default '0', nSeqAdic char(3) NOT NULL default '', cFabricante varchar(60) NOT NULL default '', vDescDi varchar(15) NOT NULL default '', xPed int(6) NOT NULL default '0', nItemPed int(6) NOT NULL default '0', nDI varchar(12) NOT NULL default '' ) TYPE=InnoDBERROR 1064 (42000) at line 19: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=InnoDB' at line 9 Ps: i did try to change TYPE TO ENGINE and its solve the problem. can anybody help me? Thanks a lot. Michel |
Unable to drop non-PK index because it is referenced in a foreign key constraint Posted: 23 Aug 2013 01:51 PM PDT I have a table named I noticed there is an additional non-clustered unique index Why is the FK constraint relying on the non-clustered unique index instead of the primary key constraint? How do I update the FKs to use the clustered PK index instead of the other index? |
Optimize simple query using ORDER BY date and text Posted: 23 Aug 2013 12:46 PM PDT I have a query to a table in Postgres with an order based on a date field and a number field, this table has 1000000 records The data types of the table are: The query is: This query takes about 5 seconds, but if I take out the "order by" the query takes only 0.499 seconds The problem I have is that I need to run this query in the shortest time possible, so I search on google what can I do and create a composite index with the following query But the query is taking the same time or even more. I'm using Postgres 9.0.13, here is the EXPLAIN with 73436 rows Postgres is running on a Phenon II 1055T (3 cores) With 8 GB Ram and 500 GB disk. How I can optimize this query? |
Mysql Fragmentation. How bad is too bad? Posted: 23 Aug 2013 06:33 PM PDT I ran a table status for my companies production site and its showing close to around '49085939712' for just about every table in my database and we have around 400 tables. I am not a DB administrator and my mysql skills are not the best when it comes to optimizing. To me it looks pretty bad. but I need everyone else's oppinion. My question is how bad is too bad. What is an on average threshold to know when its time to optimize a single table. |
How big should I make a column in an audit table for storing the output of COLUMNS_UPDATED()? Posted: 23 Aug 2013 10:10 AM PDT I have a stored procedure which creates a complementary trigger and audit table when a table name is passed into it. The SP filters out all the calculated columns and other stuff that stops you doing an 'SELECT *' for auditing and then writes a trigger that inserts those specific columns from In a recent round of testing I was asked to set up the auditing on a test database. This caused inserts in our main table to fail because "string or binary data would be truncated", after investigation I found the column where the results of The definition of the column was: Changing the definition to this has made everything work again: However what this highlights is that I don't understand the relationship between the number of columns in the table (95 in this case, 7 of which are calculated) and the size of the output from So my question is: what is the relationship? Secondary question: Can I easily derive from the number of columns that will be audited a value for |
Deleting users need delete procedures [on hold] Posted: 23 Aug 2013 01:39 PM PDT I have an MDF from 2000, in these years many times whe have move this database by backup to another computer and/or domains, ![enter image description here][1] to delete and user need to delete , the permissions of this users in objects like procedures, have a simple way to delete users or know with procedures are linked to this user??? I need to delete old or not active users. Clearing : I have a lot of old/inactive user, from other domains, for delete an user i make this . Security\USers the i choose the user right click , delete , then SQL show me a message, can not delete the user , because have permissions in varius procedures, then i must to open the procedure one by one delete the user from all the procedures , and late i can delete, have ay way to do this more simples. Thanks Alejandro. |
mysql replication for certain dababases Posted: 23 Aug 2013 05:25 PM PDT I am new to mysql and I have a query in regards to mysql replication. Currently, I have a master database that replicates to four slave servers at the moment. I would need to set up a few replication servers(as slave) but these will replicate only a few databases. How would approach this issue? Should I be using something like this on slave /etc/my.cnf? replicate-ignore-db=db_name Can I set something on slave configuration stating exactly which databases and tables to be replicated? Should the changes happen only on the slave configuration or on master as well? The reason being this master server currently replicates whole lot of databases to other slaves which will remain as it is. |
Replication is missing a specific set of rows on subscriber Posted: 23 Aug 2013 11:13 AM PDT So I've got two servers, we'll call them Server A and Server B. Server A has a table, Table 1, which gets replicated to Server B. Server B has a table, Table 2, which gets replicated to Server A. All replication is transactional and pushed from the publisher continuously. On Server B, there is a trigger on Table 1 which will ultimately create a record in Table 2. Other various processes also create additional records in Table 2. All of the records in Table 2 are supposed to get replicated back to Server A. In short, the data from Server A, Table 1 is supposed to make a round trip back to Server A in table 2 along with other records. However only the 'other records' are coming back. None of the data which originated on Server A is coming through, even though it's been successfully inserted into Table 2 on Server B. Any ideas? Additional info: When I generate a new snapshot all those records that didn't replicate are included in the snapshot and do get replicated over. My suspicions lie in what's happening behind the scenes when the trigger fired by replication inserts the data into Table 2 and perhaps something is preventing those records from replicating over. The trigger looks something like: And up_INS_TableB transforms and inserts the Table A data into Table B |
How can I find the not used numbers in a column? Posted: 23 Aug 2013 12:13 PM PDT How can I find in a column filled with numbers, that ones that are not used. Table_A: If I |
What are the ports and directionality of the TCP connections used in MySQL replication? Posted: 23 Aug 2013 02:32 PM PDT I wanted to know how replication works in mysql. Both slave and master have mysql server running say on port 3306. Slave acts like a client and master acts like a server. Does slave always bind to 3306 when it makes a tcp connection to send the request? When the response is sent back by server the dest port will be 3306 and since slave mysql is listening to that port it will process the response? Not sure if my understanding is correct. Also I am interested in knowing ingress and egress rules that should be added for replication to work. For TCP connection from slave will it pick any available TCP port or is it always 3306? Any help is appreciated! Thanks! |
Trace flag and which need to be turned off and Why Posted: 23 Aug 2013 04:46 PM PDT In SQL server there are so many trace flags. Why some of them need to be turned off. Some where i saw that trace flag 8017 need to be turned off. So i want to know which trace flag need to be tuned off and Why? |
Streaming Replication Resource Management (PGSQL) on FreeBSD 8.x Posted: 23 Aug 2013 10:31 AM PDT I am attempting to set up PGSQL-HA streaming replication on freeBSD 8.2 (willing to upgrade to 8.4 if need be). The set up is simple: 2 nodes, one active one standby. I have successfully set up streaming replication between the two nodes, but I am now trying to set up a resource agent/manager to deal with automatic failover and STONITH. I have attempted to use Heartbeat/Corosync/Pacemaker for this, but am running into difficulty building them from source (Pacemaker, in particular). Is there an easier way than using Pacemaker for a simple 2 node set up? I have little experience with this and especially with freeBSD. Thanks! *Note: FreeBSD 8.x is required, the servers are running other services that would make it too difficult to upgrade or change the OS |
Mysql foreign key cascade delete Posted: 23 Aug 2013 01:15 PM PDT Does mysql have a way to delete all sub links if a row was deleted from a "parent" table? Example table setup is below, the issue I am trying to avoid is having to maintain a script that deletes the data as the table ex_item_a will have a lot of similar tables[they have that same foreign key relationship]....In this case, let's say if I delete someone from the user table it should delete all links. *UPDATE*: I did a little more research and tested on my local database, found out that the child tables just need to cascade delete and it works from the top down perfectly. |
Geohash implementation in PostgreSQL Posted: 23 Aug 2013 08:52 PM PDT Are there any geohash implementation for PostgreSQL? I couldn't find any. |
SQL Server 2012 Express fails at repair install, produces error 5178 Posted: 23 Aug 2013 01:38 PM PDT My SQL Server Express Service will not start up. To produce this problem, I basically cloned my old hard drive (Which had SQL Server Express 2012 installed) to a new hard drive (Seagate Momentus XT 750). EDIT: I am adding info on how I cloned my hard drive as per request of SQLRockStar. I used Seagate DiscWizard. The program was producing errors when trying to clone the HD when using the simple "clone HD" command. So I "cloned" it the following way with the help of SeaGate Tech support:
Afterwards, I tried starting SQL Server Express 2012 on my Momentus XT and it would not start. So, I tried performing a repair installation of SQL Server, and it failed: see summary below: I looked at the error log and it said
I read that last error message and am really confused. I'm led to believe that this is a problem with SQL Server, My HD has 4096 sector size. UPDATE:More information: I have discovered that My old hard Drive was 512 physical sector size and my new HD is 4096 sector size. I hear that there are conversion issues between the two sector sizes, but SQL Server is the only program that is producing errors on my system, I don't understand it. UPDATE:I have attempted to uninstall SQL Server and reinstall it. It did not succeed in installing the instance. |
MySQL row does not persist, but primary key with auto-increment is incremented Posted: 23 Aug 2013 04:28 PM PDT I have a MySQL database that is acting oddly. I insert a new row and observe that for a brief period of time (less than 30 seconds), the row persists as expected in the table. After this time, though, the row vanishes (despite no other queries being executed). This table has an integer ID as a primary key, with auto-increment set, and the primary key is auto-incremented as expected for new rows. This leads me to believe there is not some kind of transactional rollback (and my table is MyISAM, so that shouldn't be possible anyways) or anything else that is somehow reverting the database to a previous state. What logs should I be checking to see what is going on here? The contents of my '/var/log/mysql/error.log' are below, but I don't see anything unusual. I noted the 'crashed' mark on the appname/users table, but mysqlcheck suggests the table is OK. Any thoughts? |
Fixing wildcard expansion resulting in too many terms error (DRG-51030) Posted: 23 Aug 2013 04:14 PM PDT How can I resolve the My index creation syntax is: And my query is: There are 15 million rows in that table, and more than 50000 rows match that query. I have set
Can anybody hep me how to solve this error? |
export (mysqldump) databases from MySQL version 4.0? Posted: 23 Aug 2013 10:14 AM PDT Goal: export the schema and data from a MySQL version 4.0.16 DB. Background: I was asked to migrate a database from MySQL version 4.0.16. The database was installed on a Windows XP machine, and I just could not find mysqldump tool on that machine. I then putty into a linux machine that has mysqldump. I ran the command, but got an error: I looked up mysql reference. INFORMATION_SCHEMA is something new to version 5 and above. This means the mysqldump on the linux box is incompatible with the production MySQL server which is on v4.0.16. I tried to download Mysql 4.0 server and install it on a windows machine so that I can get hold of a compatible version, but searching on Mysql website found nothing older than 5.0. (I also tried Mysql workbench to connect to this DB. Failed. "Unknown character set utf8") So how can I export the schema and data at all from this legacy mysql DB???... |
Posted: 23 Aug 2013 11:31 AM PDT In the past I thought I'd deleted hypothetical indexes using either a DROP INDEX statement for clustered indexes and DROP STATISTICS statement for non-clustered indexes. I have a database that is full of DTA remnants that I would like to cleanup; however, when I try to drop the object I always receive an error telling me that I cannot drop the object "because it does not exist or you do not have permission". I am a full sysadmin on the server so would expect to have rights to do anything. I've tried this with both DROP STATS and DROP INDEX statements but both give me the same error. Has anyone deleted these before and is there a trick I'm missing? Addendum Poking around in this, I just noticed that if I R-Click on the object, both the 'Script As' and 'DELETE' options are greyed out. |
Avoiding performance hit from GROUP BY during FULLTEXT search? Posted: 23 Aug 2013 11:14 AM PDT Is there any clever way to avoid the performance hit from using group by during fulltext search? In this example it's fetching the lowest post_id for unique topic_ids that match the text. With the group by to find the min, it's taking 600ms in a million row database, with about 50K rows examined. If I remove the MIN but leave the GROUP BY, it's the same slowness, so it's the GROUP hit. I suspect this is because it can only use one index, the fulltext ? Without the GROUP BY it's 1ms so this has to be filesort speed? (I've removed ORDER BY and everything else to isolate where the hit is) Thanks for any insight and ideas. (using MyISAM under mariadb if it matters) |
AWS performance of RDS with provisioned IOPS vs EC2 Posted: 23 Aug 2013 12:14 PM PDT Has anyone done a performance comparison of AWS RDS with the new provisioned IOPS vs EC2? I've found plenty of non-high IOPS RDS vs EC2 but nothing with the new high IOPS feature in RDS. |
sp_startpublication_snapshot Parameter(s) Posted: 23 Aug 2013 07:14 PM PDT I am creating a stored procedure that:
Here is my new brick wall... On this DB server, I have a 'shell' db that they will be running the SP from, that has a history table so I can keep track of who created/deleted databases using my SP's... The only parameter for sp_startpublication_snapshot is @publication... I can give it the publication name, but since I am not running it from the publishing database, how do I specify the publishing database? i.e.: the publication shows up as: but I am running the script from the database [WC_QACatalog] Any ideas about how to accomplish this? Thank you, Wes |
You are subscribed to email updates from Recent Questions - Database Administrators Stack Exchange To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment