重庆思庄Oracle、Redhat认证学习论坛

标题: Linux使用命令把前台和后台的进程互相转换 [打印本页]

作者: jiawang    时间: 2020-11-26 14:37
标题: Linux使用命令把前台和后台的进程互相转换
一、Shell支持作用控制,有以下命令:
command         让进程到后台运行
jobs  -l   查看后台运行的进程
fg   %n   让后台运行的进程n到前台来
bg   %n让进程n到后台去
PS : "n"为jobs查看到的金城编号

二、执行命令&切换到后台
   在linux终端运行命令的时候,在命令行结尾上加&符号,就可以让程序在后台运行

测试:
[oracle@strong backup]$ ll
total 8
-rw-r--r-- 1 oracle dba 150 Nov 26 13:56 backup.rcv
-rwxr-xr-x 1 oracle dba 290 Nov 26 14:14 backup.sh
[oracle@strong backup]$ more backup.rcv
run{
allocate channel c1 device type disk;
backup incremental level 0 database format '/home/oracle/RmanBackup/db0_%d_%T_%s';
release channel c1;
}

[oracle@strong backup]$


执行命令&切换到后台
[oracle@strong backup]$ ./backup.sh &
[1] 23533
[oracle@strong backup]$ RMAN> 2> 3> 4> 5> 6>


验证:
[oracle@strong ~]$ cd RmanBackup/
[oracle@strong RmanBackup]$ ll
total 1129544
-rw-r----- 1 oracle dba 1146822656 Nov 26 14:35 db0_ORCL_20201126_7
-rw-r----- 1 oracle dba    9830400 Nov 26 14:35 db0_ORCL_20201126_8

[oracle@strong backup]$ more backup.log

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Nov 26 14:35:27 2020
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (DBID=1575005578)

RMAN> run{
2>  allocate channel c1 device type disk;
3>  backup incremental level 0 database format '/home/oracle/RmanBackup/db0_%d_%T_%s';
4> release channel c1;
5> }
6>
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=41 device type=DISK

Starting backup at 26-NOV-20
channel c1: starting incremental level 0 datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel c1: starting piece 1 at 26-NOV-20
channel c1: finished piece 1 at 26-NOV-20
piece handle=/home/oracle/RmanBackup/db0_ORCL_20201126_7 tag=TAG20201126T143528 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:15
channel c1: starting incremental level 0 datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel c1: starting piece 1 at 26-NOV-20
channel c1: finished piece 1 at 26-NOV-20
piece handle=/home/oracle/RmanBackup/db0_ORCL_20201126_8 tag=TAG20201126T143528 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 26-NOV-20

released channel: c1

Recovery Manager complete.
[oracle@strong backup]$










欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2