database-administration

Share_buffer_size in postgresql

丶灬走出姿态 提交于 2019-12-13 07:02:23
问题 I have a Postgres 9.3 DB on RHEl 6.4. I am getting DB connection time out from a server which is on RHel6.4. The following data is SAR data when this issue occurred. 00:00:01 CPU %usr %nice %sys %iowait %steal %irq %soft %guest %idle 02:10:01 all 0.05 0.00 0.29 3.06 0.00 0.00 0.05 0.00 96.55 02:20:01 all 0.07 0.00 0.28 3.84 0.00 0.00 0.05 0.00 95.75 00:00:01 kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit 02:10:01 781108 65150968 98.82 151576 60250076 5905400 7.17 02:20:01

How to store sql result without creating a table to store the result of a stored procedure

对着背影说爱祢 提交于 2019-12-13 05:35:28
问题 We are running exec xp_fixeddrives to get the free space for each physical drive associated with the SQL Server. I am running this code as part of an SSIS package which fetches all the SQL servers free space. Currently I am creating a table in tempdb and inserting the results of exec xp_fixeddrives into this table. But the issue I am facing is, when ever the server is restarted I am facing access issue as the table is on Tempdb . I don't really like the idea of creating a table in Master DB

What is the fastest way to rebuild PostgreSQL statistics from zero/scratch with ANALYZE?

こ雲淡風輕ζ 提交于 2019-12-13 03:46:26
问题 I have a PostgreSQL v10 database with a size of about 100GB. What is the most efficient (fastest) way to rebuild statistics, for example after a major version upgrade? ANALYZE with no parameters updates statistics for then entire database by default — it's painfully slow! This seems like a single process. Is there any way to parallelize this to speed it up? 回答1: You could use vacuumdb with the same options that pg_upgrade suggests: vacuumdb --all --analyze-in-stages The documentation

How to correctly make a public synonym

不打扰是莪最后的温柔 提交于 2019-12-12 08:29:58
问题 This is a pretty silly one, but I need help. I have a table owned by mydbowner. It is named mydbowner.mytable. I tried to make a public synonym by issuing the command: CREATE OR REPLACE PUBLIC SYNONYM mytable FOR mydbowner.mytable; When I do this, and I query the table I get: ORA-01775: looping chain of synonyms How do I make this synonym without having the problem. 回答1: I think Justin is on the right track. What I think it actually means is that mydbowner.mytable doesn't exist. Here's an

Synchronising multiple tables

时光总嘲笑我的痴心妄想 提交于 2019-12-12 03:36:59
问题 I have multiple tables which needs to be in-sync with the production database tables. Is there any way to ensure the data is synced with the production database other than manually updating the tables. 回答1: You can use the liquibase for this purpose. This is awesome tool for database Liquibase is an open source database-independent library for tracking, managing and applying database schema changes. It was started in 2006 to allow easier tracking of database changes, especially in an agile

SQL Server Agent job dependency

跟風遠走 提交于 2019-12-12 02:19:10
问题 We have a 4h datawarehouse job that runs every 4h on 4h schedule. We want to create a new 'daily' schedule and have some processes run out of hours. However, if when the daily job comes to run and the 4h job is still running, I would like it to wait for the 4h job to complete, then run (or have a specified duration). I haven't decided which is best yet... How is this possible? Thanks! Please do not suggest 3rd party options as I have no control over the infrastructure. 回答1: Please maintain

MySQL's on update now() working for one table and not for another when updated by Hibernate

依然范特西╮ 提交于 2019-12-12 02:15:14
问题 I can't make MySQL to update a TIMESTAMP field marked as CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP when the update query is made by Hibernate. According to this answer, and this comment, MySQL should handle tables with more than one column defaulting to CURRENT_TIMESTAMP . My problem is that, when updating the entities with Hibernate, that seems to work for one table, but not for another in the same schema. Also, it works fine for all tables when I run the updates directly against the DB

Workflow to apply scripts in homologation/production

跟風遠走 提交于 2019-12-12 01:56:35
问题 I'm using TFS's workitens to DBA's team apply scripts in homologation/production, so, i'm creating a workitem and linking BD's scripts in it. To make sure that nobody will change the script after i created the workitem, the DBAs team is locking the scripts in TFS before aplly. I think there is another tool or method to make it safer and smarter 回答1: You can give a try with this workaround by Angela Dugan , In short the solution of Angela works as follows: Add a field [UserAccessDenied] to a

Powershell - Start ordered sequence of services

走远了吗. 提交于 2019-12-11 19:26:49
问题 I need to start an ordered sequence of services, i need that each service will be up and running before try to start the next one, how can I achieve this in Powershell? How can I wait for the stop too? Thanks, DD 回答1: If you have a list of service names (say in an array), then foreach service: Get its status If not running, then start it With a delay in the loop, check its status until it is running The key is likely to be handling all the possibilities for #3 including the service failing.

How to create one table which shares common id with another and which row gets removed in both tables once it's removed from first

爷,独闯天下 提交于 2019-12-11 16:49:14
问题 How to create one table which shares common id with another and which row gets removed in both tables once it's removed from first? I heard about FOREIGN KEY, REFERENCES but not sure how to actually create such tables. Any example to get me started? 回答1: I think you're either talking about a cascading delete or something really weird that you shouldn't do. :) Info on foreign keys: http://www.postgresql.org/docs/8.3/static/tutorial-fk.html Info on cascading deletes (search the page for "ON