https://dangkyhosting.com/huong-dan-cai-dat-zabbix-3-4-tren-centos7.html
Asia/Ho_Chi_Minh
Tham khảo: http://webgeest.blogspot.com/2015/06/purge-loghistory.html
Today, I came across a SYSAUX tablespace that was asking for more space. It was about 12Gb, which seems a bit large to me. If you use the$ORACLE_HOME/rdbms/admin/awrinfo.sql , you will get a report of the occupants. Occupant JOB_SCHEDULER took over 11Gb space, which makes you think.
The default out-of-the-box maintainance job, uses the global attribute LOG_HISTORY to remove old dbms_scheduler job logging:
select * from DBA_SCHEDULER_GLOBAL_ATTRIBUTE;
Now this is default 30 days, and can be set with:
exec DBMS_SCHEDULER.SET_SCHEDULER_ATTRIBUTE(‘log_history’,’15’);
But what if your maintainance jobs are failing for some reason (timeout/bugs?). You may need to clean it manually. The easy way to do this, is to use:
exec DBMS_SCHEDULER.PURGE_LOG(<days>, which_log=>’JOB_LOG’);
so for example:
exec DBMS_SCHEDULER.PURGE_LOG(15,which_log=>’JOB_LOG’);
But if the number of logs is very large, you have to do this carefully, step by step:
First determine the distribution of logging you have.
Select count(1) from dba_scheduler_job_log where log_date < sysdate – 100;
Make sure that you get an idea like:
| older than 300 days | 12 rows |
| older than 250 days | 12831 rows |
| older than 200 days | 438121 rows |
Now step by step clean it, by 5 or days at a time:
exec DBMS_SCHEDULER.PURGE_LOG(150,which_log=>’JOB_LOG’);
exec DBMS_SCHEDULER.PURGE_LOG(140,which_log=>’JOB_LOG’);
etc.
Until you can do:
exec DBMS_SCHEDULER.PURGE_LOG(15,which_log=>’JOB_LOG’);
Now you can set:
exec DBMS_SCHEDULER.SET_SCHEDULER_ATTRIBUTE(‘log_history’,’15’);
and watch your maintainance job (PURGE_LOG) over the next days.
What if your PURGE_LOG job doesn’t run? I had this, and a simple disable/enable was needed to get the right NEXT_RUN_DATE in dba_scheduler_jobs:
exec dbms_scheduler.disable(‘PURGE_LOG’);
exec dbms_scheduler.enable(‘PURGE_LOG’);
Now suppose that you cleaned up the job logging. After a few hours work, it’s almost done. Just run:
exec DBMS_SCHEDULER.PURGE_LOG();
Which should be fairly quick (maybe 2 minutes) now.
The tables need a shrink to release the space in the SYSAUX tablespace.
alter table sys.scheduler$_event_log enable row movement;
alter table sys.scheduler$_event_log shrink space cascade;
alter table sys.scheduler$_job_run_details enable row movement;
alter table sys.scheduler$_job_run_details space cascade;
So I followed all the advices and voodoo tricks on the thread that did not lead anywhere and found another one that finally fixed it.
My specs and situation: Windows 7 Home Premium cannot access the shared folders on any computer on my home network (same workgroup) especially not the ones off my NAS. Tried sync’ing the clocks, disabling IPv6, removing the 4to6 network adaptors (I had none), messing with secpol.msc (not available on W7 Home), the firewall is off, sharing is allowed and so on…
Finally what fixed it was re-enabling the “Client for Microsoft Networks” in the network adapter settings:
– go to Network Connections, right click the one you use -> “Properties”
– “Install” -> “Client” -> “Add”
click “Microsoft”, click OK, reboot and my shared folders appeared!!
Nguồn:
https://blog10viet.blogspot.com/2017/04/huong-dan-sua-loi-0x80070035-network.html
1. Kiểm tra mạng của centos7.
Gõ nmcli d để kiểm tra nhanh các card mạng
Lệnh nmtui để mở giao diện cấu hình
Sau đó cần restart service:
# systemctl restart network
Hoặc
# service network restart
Lệnh xem IP
# IP addr
2. Cài đặt Ruby
Trước khi cài đặt nên dùng bitvise ssh
a. Chúng ta cần cài đặt toàn bộ các gói cần thiết cho việc cài đặt ruby
# yum install gcc-c++ patch readline readline-devel zlib zlib-devel \ libyaml-devel libffi-devel openssl-devel make \ bzip2 autoconf automake libtool bison iconv-devel sqlite-devel
b. Sau đó chúng ta cài đặt rvm
# curl -sSL https://rvm.io/mpapis.asc | gpg --import - # curl -L get.rvm.io | bash -s stable c. Vào môi trường của rvm
# source /etc/profile.d/rvm.sh # rvm reload # rvm requirements run
d. Cài đặt ruby # rvm install 2.4.2 e. Nếu có nhiều version ruby được cài đặt thì dùng default version: # rvm list
# rvm use 2.4.2 --default
f. kiểm tra phiên bản ruby đã cài # ruby --version g. cài đặt bundler # gem install bundler
3. Cài đặt git
# yum install git
4. Dùng lệnh clone
Trước đó nên dùng lệnh > mkdir để tạo thư mục respo, sau đó cd vào thư mục này
a. Dựa vào docs https://github.com/lord/slate ta cài như sau:
#git clone https://github.com/lord/slate.git
b. Sau khi clone xong cd vào thư mục slate
# bundle install
c. chỉnh sửa port để chạy thử ứng dụng
# vi config.rb
d. Lưu ý để chạy ứng dụng web, cần load được thêm js runtime, do đó cần cài đặt nodejs
# yum install nodejs
e. Lưu ý cần mở firewall cho port ở centos 7 nếu muốn truy cập từ máy khác
# firewall-cmd --get-active-zones
# firewall-cmd --zone=dmz --add-port=2888/tcp --permanent or # firewall-cmd --zone=public --add-port=2888/tcp --permanent # firewall-cmd --reload
Error: you-cant-access-this-shared-folder-because-your-organizations-security-policies-block-unauthenticated-guest-access

Bị lỗi trên cần chỉnh registry:
Default Registry Value: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters] "AllowInsecureGuestAuth"=dword:0 Configured Registry Value: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters] "AllowInsecureGuestAuth"=dword:1
Nếu không được cần chỉnh thêm policy:
Tham khảo:
http://www.dba-oracle.com/t_repair_corrupt_blocks.htm
https://oracle-base.com/articles/misc/detect-and-correct-corruption
https://blog.dbi-services.com/rman-backup-is-failing-due-to-qcorrupt-blocksq/
Thường gặp lỗi này là do ổ đĩa bị lỗi
Oracle cung cấp view đê chúng ta kiểm tra
select * from v$database_block_corruption
Hoặc nếu ta biết chính xác file và block bị lỗi có thể chạy query sau để biết chính xác khối bị lỗi:
select
relative_fno,
owner,
segment_name,
segment_type
from
dba_extents
where
file_id = 6
and
437 between block_id and block_id + blocks – 1;
Lệnh này mapping luôn ra segment bị lỗi
SELECT DISTINCT owner, segment_name
FROM v$database_block_corruption dbc
JOIN dba_extents e ON dbc.file# = e.file_id AND dbc.block# BETWEEN e.block_id and e.block_id+e.blocks-1
ORDER BY 1,2;
Như mô tả của link
RMAN > validate check logical database
Thấy có dòng validate found one or more corrupt blocks
RMAN > blockrecover corruption list
Một lần nữa cùng nguyên nhân trên, ta lặp lại validate check logical database & blockrecover corruption list trong rman để giải quyết vấn đề
Cập nhật quan trọng trong trường hợp không có backup
Ta cần dùng lệnh scan toàn bộ database oracle tìm corrupt:
sau khi thực hiện lệnh này thì lỗi corrupt sẽ được tổng hợp trong view:
select * from V$DATABASE_BLOCK_CORRUPTION
Thường khối corrupt sẽ liên quan đến table hoặc index cụ thể, ta có lệnh sau để tổng hợp ra chúng:
SELECT e.owner, e.segment_type, e.segment_name, e.partition_name, c.file#
, greatest(e.block_id, c.block#) corr_start_block#
, least(e.block_id+e.blocks-1, c.block#+c.blocks-1) corr_end_block#
, least(e.block_id+e.blocks-1, c.block#+c.blocks-1)
– greatest(e.block_id, c.block#) + 1 blocks_corrupted
, null description
FROM dba_extents e, v$database_block_corruption c
WHERE e.file_id = c.file#
AND e.block_id <= c.block# + c.blocks – 1
AND e.block_id + e.blocks – 1 >= c.block#
UNION
SELECT s.owner, s.segment_type, s.segment_name, s.partition_name, c.file#
, header_block corr_start_block#
, header_block corr_end_block#
, 1 blocks_corrupted
, ‘Segment Header’ description
FROM dba_segments s, v$database_block_corruption c
WHERE s.header_file = c.file#
AND s.header_block between c.block# and c.block# + c.blocks – 1
UNION
SELECT null owner, null segment_type, null segment_name, null partition_name, c.file#
, greatest(f.block_id, c.block#) corr_start_block#
, least(f.block_id+f.blocks-1, c.block#+c.blocks-1) corr_end_block#
, least(f.block_id+f.blocks-1, c.block#+c.blocks-1)
– greatest(f.block_id, c.block#) + 1 blocks_corrupted
, ‘Free Block’ description
FROM dba_free_space f, v$database_block_corruption c
WHERE f.file_id = c.file#
AND f.block_id <= c.block# + c.blocks – 1
AND f.block_id + f.blocks – 1 >= c.block#
order by file#, corr_start_block#;
Từ đó ta sẽ cần tạo lại table hoặc index để fix lỗi
Để kiểm tra fix được lỗi hay chưa ta nên lặp lại quy trình check
RMAN> BACKUP CHECK LOGICAL VALIDATE DATABASE;
Thật không may là việc chặn lại không thể sử dụng vì nó đòi hỏi một phiên bản Oracle Enterprise Edition và chúng tôi đang chạy Oracle Standard Edition.
Tôi cũng đã cố gắng để sửa chữa khối này với dbms_repair gói, nhưng dbms_repair không có bất kỳ tùy chọn để sửa chữa một khối bị hỏng có sản phẩm nào.
Sau một số phân tích sâu hơn, tôi quyết định để lại khối trống rỗng bị rạn nứt này vào cơ sở dữ liệu, như một khối không sử dụng bị hỏng không có hại. Khi Oracle sẽ sử dụng lại khối này để gán nó cho một phân đoạn, Oracle sẽ tự động định dạng lại khối này, và vấn đề sẽ được giải quyết.
1) Ở server nguồn:
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqldump -u root -p -R –databases
dbname > c:\exports\dbname.mysql
Tham số:
-R: export function và procedure
–databases: chỉ only
2) Ở server đích
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -u root -p dbname < “C:\
imports\dbname.mysql”
Tham khảo:
http://dbarohit.blogspot.com/2013/08/ora-01552-cannot-use-system-rollback.html
https://www.akadia.com/services/ora_crash_recovery.html
Lỗi khi chạy rman clone lỗi
Recently I have met with an issue where the undo tablespace of the Prod database is got corrupted and we required to create the new undo tablespace coz we had no undo backup. While creating the undo tablespace we got the following error:
SQL> create undo tablespace undotbs2
2 datafile ‘/u01/app/oracle/oradata/db1/undotbs01.dbf’ size 100m;
create undo tablespace undotbs2
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01552: cannot use system rollback segment for non-system tablespace ‘GGATE’
ORA-06512: at line 993
ORA-01552: cannot use system rollback segment for non-system tablespace ‘GGATE’
[oracle@source db1]$ ls -al undo*
-rw-r—– 1 oracle oinstall 188751872 Aug 1 11:59 undotbs01.dbf
[oracle@source ~]$mv undotbs01.dbf undotbs01.dbf.bkp
SQL> startup
ORACLE instance started.
Total System Global Area 1690705920 bytes
Fixed Size 1345380 bytes
Variable Size 1006635164 bytes
Database Buffers 671088640 bytes
Redo Buffers 11636736 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 3 – see DBWR trace file
ORA-01110: data file 3: ‘/u01/app/oracle/oradata/db1/undotbs01.dbf’
Excerpts from alert log.
ALTER DATABASE OPEN
Errors in file /u01/app/oracle/diag/rdbms/db1/db1/trace/db1_dbw0_2626.trc:
ORA-01157: cannot identify/lock data file 3 – see DBWR trace file
ORA-01110: data file 3: ‘/u01/app/oracle/oradata/db1/undotbs01.dbf’
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Tham khảo:
https://blog.pythian.com/duplicate-from-active-database-using-rman-step-by-step/
https://oracle-base.com/articles/11g/duplicate-database-using-rman-11gr2
*Lưu ý:
1) Database đã chạy ở chế độ archivelog
SQL> startup mount ORACLE instance started. SQL> alter database archivelog; Database altered. SQL> alter database open; Database altered.
2) Nếu database chưa chạy ở chế độ archivelog thì cần tạo ra backup để clone.
Tham khảo: https://www.thegeekstuff.com/2013/08/oracle-rman-backup/
Lệnh backup full:
RMAN> BACKUP AS BACKUPSET DATABASE
RMAN> BACKUP AS BACKUPSET DATABASE PLUS ARCHIVELOG; (kết hợp archivelog) *Lưu ý trước khi clone lên bật archivelog để khi có thay đổi trong database thì sẽ đẩy sang bản clone.
Dùng rman kết nối tới source db (target) va aulixi…
*Lưu ý:
copy đúng folder to folder
Dùng oradim để new instance…
đặt password sys trùng với database cũ
CMD> orapwd file=[ORACLE_HOME]/dbs/orapw[SID] password=[sys_password] Hoặc chạy mặc định CMD> orapwd password = ""
Sau đó startup nomount
RMAN> DUPLICATE DATABASE TO DB11G
FROM ACTIVE DATABASE
NOFILENAMECHECK;
Done
Nếu như database clone có same name
thì cần chạy kiểu như sau
run {
duplicate database ONETOURP DBID 35608629
to ONETOURP
noredo
nofilenamecheck;
}
*Lưu ý cần chỉnh registry nếu database không tự start
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\
CurrentVersion\Internet Settings -> ProxySettingsPerUser