Senin, 11 Februari 2019

SQL Sever How to shrink or Backup Log growth on mirroring or Always-on


Shrinking database log files in an AlwaysOn Availability Group environment
If you're slacking and not backing up your transaction logs for your synchronized AlwaysOn databases, you may be running out of disk space from built up logs. In fact, you're probably here because you received an alert about your SQL server data disks filling up and are in a slight panic. OK, I get it, let's get on with it.

This is more complicated than shrinking logs in a non-HA instance, pay attention:

1.            Login to your database server and open a New Query window
2.            Execute the backup command to backup the transaction log to a null location:

BACKUP LOG databaseName TO DISK='NUL:' WITH NO_CHECKSUM, CONTINUE_AFTER_ERROR
o        NUL is used so it will not actually write the backup to the disk- you won't lose precious disk space.
o        This may take a bit depending on the size of the log. It will also grow the log file slightly.
o        We use CONTINUE_AFTER_ERROR because we don't care if the log is corrupt. It's going to be deleted soon anyway.
3.            Execute the shrink command and take a look at the results:

DBCC SHRINKFILE (databaseName_log, EMPTYFILE);
o        This command attempts to shrink the log file to nothing (empty it). 
o        Look at the results, you will see column CurrentSize. If the column has a large number, it probably didn't shrink much. Check the screenshot at the bottom for an example.
o        Do not expect CurrentSize to drop all the way to 0 unless the database is pretty docile
4.            Execute all 3 commands in this order, in the same query window, until you notice the CurrentPages dropping in the results.

BACKUP LOG databaseName TO DISK='NUL:' WITH NO_CHECKSUM, CONTINUE_AFTER_ERROR

Use databaseName
dbcc loginfo

DBCC SHRINKFILE (databaseName_log, EMPTYFILE);
o        The backup will run quicker now that you have already taken the original 'big' backup
o        The more the database is in use, the more you will have to execute it- the transaction log is always changing
5.             That's it, check your log file size. Screenshot example below
This example was on a SharePoint config log file that was 80GB!


Minggu, 30 April 2017

JQuery EasyUI

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Basic CRUD Application - jQuery EasyUI CRUD Demo</title>
  6. <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/color.css">
  9. <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
  10. <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
  11. <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
  12. </head>
  13. <body>
  14. <h2>Basic CRUD Application</h2>
  15. <p>Click the buttons on datagrid toolbar to do crud actions.</p>
  16. <table id="dg" title="My Users" class="easyui-datagrid" style="width:700px;height:250px"
  17. url="get_users.php"
  18. toolbar="#toolbar" pagination="true"
  19. rownumbers="true" fitColumns="true" singleSelect="true">
  20. <thead>
  21. <tr>
  22. <th field="firstname" width="50">First Name</th>
  23. <th field="lastname" width="50">Last Name</th>
  24. <th field="phone" width="50">Phone</th>
  25. <th field="email" width="50">Email</th>
  26. </tr>
  27. </thead>
  28. </table>
  29. <div id="toolbar">
  30. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">New User</a>
  31. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">Edit User</a>
  32. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyUser()">Remove User</a>
  33. </div>
  34. <div id="dlg" class="easyui-dialog" style="width:400px"
  35. closed="true" buttons="#dlg-buttons">
  36. <form id="fm" method="post" novalidate style="margin:0;padding:20px 50px">
  37. <div style="margin-bottom:20px;font-size:14px;border-bottom:1px solid #ccc">User Information</div>
  38. <div style="margin-bottom:10px">
  39. <input name="firstname" class="easyui-textbox" required="true" label="First Name:" style="width:100%">
  40. </div>
  41. <div style="margin-bottom:10px">
  42. <input name="lastname" class="easyui-textbox" required="true" label="Last Name:" style="width:100%">
  43. </div>
  44. <div style="margin-bottom:10px">
  45. <input name="phone" class="easyui-textbox" required="true" label="Phone:" style="width:100%">
  46. </div>
  47. <div style="margin-bottom:10px">
  48. <input name="email" class="easyui-textbox" required="true" validType="email" label="Email:" style="width:100%">
  49. </div>
  50. </form>
  51. </div>
  52. <div id="dlg-buttons">
  53. <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveUser()" style="width:90px">Save</a>
  54. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
  55. </div>
  56. <script type="text/javascript">
  57. var url;
  58. function newUser(){
  59. $('#dlg').dialog('open').dialog('center').dialog('setTitle','New User');
  60. $('#fm').form('clear');
  61. url = 'save_user.php';
  62. }
  63. function editUser(){
  64. var row = $('#dg').datagrid('getSelected');
  65. if (row){
  66. $('#dlg').dialog('open').dialog('center').dialog('setTitle','Edit User');
  67. $('#fm').form('load',row);
  68. url = 'update_user.php?id='+row.id;
  69. }
  70. }
  71. function saveUser(){
  72. $('#fm').form('submit',{
  73. url: url,
  74. onSubmit: function(){
  75. return $(this).form('validate');
  76. },
  77. success: function(result){
  78. var result = eval('('+result+')');
  79. if (result.errorMsg){
  80. $.messager.show({
  81. title: 'Error',
  82. msg: result.errorMsg
  83. });
  84. } else {
  85. $('#dlg').dialog('close'); // close the dialog
  86. $('#dg').datagrid('reload'); // reload the user data
  87. }
  88. }
  89. });
  90. }
  91. function destroyUser(){
  92. var row = $('#dg').datagrid('getSelected');
  93. if (row){
  94. $.messager.confirm('Confirm','Are you sure you want to destroy this user?',function(r){
  95. if (r){
  96. $.post('destroy_user.php',{id:row.id},function(result){
  97. if (result.success){
  98. $('#dg').datagrid('reload'); // reload the user data
  99. } else {
  100. $.messager.show({ // show error message
  101. title: 'Error',
  102. msg: result.errorMsg
  103. });
  104. }
  105. },'json');
  106. }
  107. });
  108. }
  109. }
  110. </script>
  111. </body>
  112. </html>
www.ayeey.com www.resepkuekeringku.com www.desainrumahnya.com www.yayasanbabysitterku.com www.luvne.com www.cicicookies.com www.tipscantiknya.com www.mbepp.com www.kumpulanrumusnya.com www.trikcantik.net