Linux实用命令
临时:
set GLOBAL max_connections=9120;
show variables like '%max_connections%';
永久:
修改mysql配置文件my.cnf,在[mysqld]段中添加或修改max_connections值:
max_connections=9120
开机扫描新增硬盘
echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host2/scan
echo "- - -" > /sys/class/scsi_host/hostN/scan
systemctl stop rpcbind
systemctl stop rpcbind.socket
systemctl stop nfs-server
systemctl stop nfs
systemctl status rpcbind.socket
systemctl status rpcbind
systemctl status nfs-server
systemctl start rpcbind.socket
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs
systemctl status rpcbind.socket
systemctl status rpcbind
systemctl status nfs-server
systemctl enable rpcbind.socket
systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;
sqlplus system/123456@192.168.3.191:1521/orcl as sysdba
select table_name from user_tables; 查看当前用户的表
删除 45 天前的文件
find /backup-mysql -name "*" -mtime +45 -exec rm -rf {} \;
find /backup-oracle -name "*" -mtime +45 -exec rm -rf {} \;
find /backup-logfile -name "*" -mtime +45 -exec rm -rf {} \;
mysqldump -uroot -p123456 nbp > /root/aisai-03-24.sql
find ./ -name "*" -mtime +45 -exec rm -rf {} \;
samba配置
/etc/samba/smb.conf
[test1]
path = /test1
writable = yes
browsable = yes
guest ok = yes
guest only = yes
create mode = 0777
directory mode = 0777
select log_mode from v$database; --检查当前归档日志是否开启?
select * from v$flash_recovery_area_usage; --查看空间占用率
select * from v$recovery_file_dest; --查看归档日志的存放地址
删除过期归档日志:
delete expired archivelog all;
查看所有归档日志
list archivelog all;
一、物理文件已被删除的归档日志处理
1、oracle用户下进入rman命令窗口
[oracle@fpdb2 ~]$ rman target /
rman>
2、检查归档日志
rman> crosscheck archivelog all;
33、删除过期归档日志
rman> delete expired archivelog all;
二、物理文件未删除的情况下可以直接删除指定时间的归档日志
1、oracle用户下进入asmcmd命令窗口
[oracle@fpdb2 ~]$ rman target /
rman>
2、检查归档日志
rman> crosscheck archivelog all;
3、删除归档日志,下面有几个例子:
a、删除三天之前的所有归档日志
rman> delete archivelog all until time 'sysdate-3';
b、删除7天前至3天前的所有归档日志
rman> delete archivelog all from time 'sysdate-7' until time 'sysdate-3';
c、删除7天前所有的归档日志,如果使用了闪回功能,也会删除闪回的数据
rman> delete archivelog all completed before 'sysdate-7';
rman> crosscheck archivelog all;
crosscheck backup of archivelog all;
1、$rman target /
2、RMAN> crosscheck archivelog all;
3、RMAN> list expired archivelog all;
4、RMAN> delete expired archivelog all;
5、RMAN> delete archivelog until time "sysdate-7"; -----删除系统当前时间7天前的归档日志
6、RMAN> crosscheck archivelog all; ------再次执行,检查归档日志是否已经被删除
select name from v$database;
select instance_name from v$instance;
select status from v$instance;
archive log list;
select name from v$database;
select name from v$datafile; #查看数据文件
select name from v$controlfile; #查看控制文件
select member from v$logfile; #查看日志文件
select name from v$datafile;
select name from v$controlfile;
select member from v$logfile;
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+OADATA02/lzmis1/datafile/system.256.881713489
+OADATA02/lzmis1/datafile/sysaux.257.881713489
+OADATA02/lzmis1/datafile/undotbs1.258.881713489
+OADATA02/lzmis1/datafile/users.259.881713489
+OADATA02/lzmis1/datafile/undotbs2.264.881713693
+OADATA02/lzmis1/datafile/workflow01.ora
+OADATA02/lzmis1/datafile/workflow02.ora
+OADATA02/lzmis1/datafile/xdb.ora
+OADATA02/lzmis1/datafile/tools.ora
+OADATA02/lzmis1/datafile/report02.ora
+OADATA02/lzmis1/datafile/hisfile01.ora
NAME
--------------------------------------------------------------------------------
+OADATA02/lzmis1/datafile/hisfile02.ora
+OADATA02/lzmis1/datafile/drsys.ora
+OADATA02/lzmis1/datafile/archive01.ora
+OADATA02/lzmis1/datafile/archive02.ora
+OADATA02/lzmis1/datafile/indx.ora
+OADATA02/lzmis1/datafile/workflow0101.ora
+OADATA02/lzmis1/datafile/workflow0102.ora
+OADATA02/lzmis1/datafile/workflow0103.ora
+OADATA02/lzmis1/datafile/workflow0201.ora
+OADATA02/lzmis1/datafile/workflow0202.ora
+OADATA02/lzmis1/datafile/workflow0203.ora
NAME
--------------------------------------------------------------------------------
+OADATA02/lzmis1/datafile/workflow0204.ora
+OADATA02/lzmis1/datafile/workflow0205.ora
+OADATA03/lzmis1/datafile/sysaux.257.8817134810.ora
+OADATA03/lzmis1/datafile/system.256.881713410.ora
+OADATA03/lzmis1/datafile/undotbs20180102.ora
+OADATA03/lzmis1/datafile/undotbs20180102-2.ora
+OADATA02/lzmis1/datafile/workflow0206.ora
rman target / 进入rman管理操作
crosscheck archivelog all;查看所有的归档日志文件
归档开启之后,经常会出现归档日志满导致数据库无法正常使用的情况,
我们可以使用rman对数据库日志进行删除,
释放空间,
输入下面命令删除7天之前的归档日志
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
当手工删除了归档日志以后,Rman备份会检测到日志缺失,从而无法进一步继续执行。
所以此时需要手工执行crosscheck过程,之后Rman备份可以恢复正常。
1.Crosscheck日志
RMAN>crosscheck archivelog all;
2.使用delete expired archivelog all 命令删除所有过期归档日志:
RMAN> delete expired archivelog all;
3.使用report obsolete命令报告过期备份
RMAN> report obsolete;
4.使用delete obsolete命令删除过期备份:
RMAN> delete obsolete;
rman target /
show all
CONFIGURE CONTROLFILE AUTOBACKUP ON;
show parameter spfile; 查看文件spfile位置
systemctl stop rpcbind
systemctl stop rpcbind.socket
systemctl stop nfs-server
systemctl start rpcbind
systemctl start nfs-server
cd $ORACLE_HOME/lib
ls -l | grep libobk.so
#!/bin/bash
if [ -f ~/.bash_profile ];
then
. ~/.bash_profile
fi
export ORACLE_SID=enet2
export BACKUP_DIR=/newstart/test1
$ORACLE_HOME/bin/rman msglog=/newstart/logs/enet2_0_2019-11-04_20-35-26.log <<EOF
connect target sys/minstone
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
allocate channel c1 type sbt;
sql 'alter system archive log current';
backup incremental level 0 cumulative database format 'level_0_%d_%s_%p_%u_%T.dbf' include current controlfile;
backup archivelog all format 'log_%d_%s_%p_%u_%T.arch' delete all input;
release channel c1;
}
exit;
EOF
exit $?
systemctl list-units| grep nbp
systemctl status nbp-agent.service
nc -v 10.50.118.14 1111
查看系统版本
rpm -q centos-release
免密登录本机做:
ssh-keygen -t rsa
NDP文件备份服务 的 服务端操作
ssh-keygen -t rsa
cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys
LINkk#4@kkmkwzdefz986k
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.32.202
ssh-keygen -R 192.168.32.16
ssh 192.168.32.16
select * from t_agent where agent_id="7E88E2BE-4B36-4497-968C-230A9811505F";
ssh-copy-id -i ~/.ssh/id_rsa.pub root@172.21.22.24(对端ip)
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.32.100
ssh-copy-id -i ~/.ssh/id_rsa.pub root@10.10.0.34
ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@172.21.21.51
tail -F /var/log/silk/nbp-
scp -p ~/.ssh/id_rsa.pub root@172.31.103.19:/root/.ssh/authorized_keys
scp -p ~/.ssh/id_rsa.pub oracle@172.21.21.35:/home/oracle/.ssh/authorized_keys
alias cmd="/root/nbp-tool -act cmd -in /root/ip -u root -p ossdbg1 -f "
alias push="/root/nbp-tool -act push -in /root/ip -u root -p ossdbg1 -f "
mkdir -p /root/.ssh/
/root/.ssh/id_rsa.pub
mv /root/id_rsa.pub /root/.ssh/authorized_keys
./nbp-tool -act cmd -in ip -p Cgsl@123 "mkdir -p /root/.ssh/"
./nbp-tool -act push -in ip -p Cgsl@123 "/root/.ssh/id_rsa.pub" "/root/"
./nbp-tool -act cmd -in ip -p Cgsl@123 -f "cp -Rf /root/id_rsa.pub /root/.ssh/authorized_keys"
https://www.cnblogs.com/flylinux/p/7498327.html
date "+%Y-%m-%d"
date "+%H:%M:%S"
date "+%Y-%m-%d %H:%M:%S"·
msyql -uroot -p nbp > zhuhai-$(date "+%Y-%m-%d").sql
msyql -uroot -p nbp > hunan-$(date "+%Y-%m-%d").sql
pip install --no-index --find-links=/root/pip_deps -r /root/require.txt
cd /opt/NDP/silk
python setup.py develop
touch("/etc/sysconfig/nbp-rest-api")
Command("cp /root/NDP_SERVER_4.3/install/service/nbp-rest-api.service /etc/systemd/system/")
Command("systemctl enable nbp-rest-api")
Command("systemctl start nbp-rest-api")
vi /root/require.txt
scl enable python27 bash
python -V
yum repolist all
yum install -y vim screen top iotop
find /root/* -name "*distribute*"
yum install -y python2-pip