Linux权限管理

  • linux权限

    1. r 读
    2. w 写
    3. x 执行
  • linu用户

    1. 所有者(u)
    2. 所属组(g)
    3. 其他用户(o)
-rw-r--r--. 1 root root  215 Dec  2 20:16 abc.txt

用户、组、权限分配

  1. 用户管理
    useradd rick
    userdel rick
    passwd rick

  2. 用户组
    groupadd xhope
    groupdel xhope
    gpasswd -a rick xhope

  3. 权限分配
    chmod 755 test.java
    chmod g+w test.java
    chmod o-w test.java
    chmod a+w test.java

    acl权限分配

    [root@localhost common]# setfacl -m u:tmpuser:rw test.py
    [tmpuser@localhost common]$ getfacl test.py
    # file: test.py
    # owner: rick
    # group: xhope
    user::r-x
    user:tmpuser:rw-
    group::--x
    mask::rwx
    other::--x
    [root@localhost common]# setfacl -m g:xhope:rw test.py
    [root@localhost common]# setfacl -x u:tmpuser test.py
    [root@localhost common]# setfacl -b test.py
    [root@localhost common]# getfacl test.py
    # file: test.py
    # owner: rick
    # group: xhope
    user::r-x
    group::--x
    other::--x
    

PL/SQL Developer客户端连接Oracle服务器

PL/SQL Developer客户端连接Oracle服务器

  1. 下载PL/SQL Developer 最新版本Version 11.0.2.1766
  2. 下载instantclient注意Oracle是32位或者64位
    a. instantclient-basic-win32-11.2.0.1.0.zip
    b. instantclient-basic-win-x86-64-11.2.0.1.0.zip
  3. 配置:
    a. 解压对应的版本到D:\develop\instantclient_11_2
    b. 双击plsqldev.exe,开始设置Oracle Home & OCI library

        Oracle Home:D:\develop\instantclient_11_2
        OCI library:D:\develop\instantclient_11_2\oci.dll
    
  4. 登录对话框
    e.g.

        Username:aswdspc_my
        Password:aswdspc_my
        Database:10.32.186.133:1503/aswdspc
    

查看Oracle当前用户下的对象(表、视图、同义词)

0表空间

SQL>select username,default_tablespace from user_users;

查看当前用户的角色

SQL>select * from user_role_privs;

查看当前用户的系统权限和表级权限

SQL>select * from user_sys_privs;SQL>select * from user_tab_privs;

查看用户下所有的表

SQL>select * from user_tables;

1、用户查看当前用户的缺省表空间

SQL>select username,default_tablespace from user_users;

查看当前用户的角色

SQL>select * from user_role_privs;

查看当前用户的系统权限和表级权限

SQL>select * from user_sys_privs;
SQL>select * from user_tab_privs;

显示当前会话所具有的权限

SQL>select * from session_privs;

显示指定用户所具有的系统权限

SQL>select * from dba_sys_privs where grantee='GAME';

2、表查看用户下所有的表

SQL>select * from user_tables;

查看名称包含log字符的表

SQL>select object_name,object_id from user_objectswhere instr(object_name,'LOG')>0;

查看某表的创建时间

SQL>select object_name,created from user_objects where object_name=upper('&table_name');

查看某表的大小

SQL>select sum(bytes)/(1024*1024) as "size(M)" from user_segmentswhere segment_name=upper('&table_name');

查看放在ORACLE的内存区里的表

SQL>select table_name,cache from user_tables where instr(cache,'Y')>0;

 3、索引查看索引个数和类别

SQL>select index_name,index_type,table_name from user_indexes order by table_name;

查看索引被索引的字段

SQL>select * from user_ind_columns where index_name=upper('&index_name');

查看索引的大小

SQL>select sum(bytes)/(1024*1024) as "size(M)" from user_segmentswhere segment_name=upper('&index_name');

4、序列号查看序列号,last_number是当前值

SQL>select * from user_sequences;

5、视图
查看视图的名称

SQL>select view_name from user_views;

查看创建视图的select语句

SQL>set view_name,text_length from user_views;
SQL>set long 2000;

说明:可以根据视图的text_length值设定set long 的大小

SQL>select text from user_views where view_name=upper('&view_name');

6、同义词查看同义词的名称

SQL>select * from user_synonyms;

7、约束条件
查看某表的约束条件

SQL>select constraint_name, constraint_type,search_condition, r_constraint_namefrom user_constraints where table_name = upper('&table_name');
SQL>select c.constraint_name,c.constraint_type,cc.column_name from  user_constraints c,user_cons_columns ccwhere c.owner = upper('&table_owner') and c.table_name = upper('&table_name')and c.owner = cc.owner and c.constraint_name = cc.constraint_nameorder by cc.position;

8、存储函数和过程查看函数和过程的状态

SQL>select object_name,status from user_objects where object_type='FUNCTION';
SQL>select object_name,status from user_objects where object_type='PROCEDURE';

查看函数和过程的源代码

SQL>select text from all_source where owner=user and name=upper('&plsql_name');

Linux常用命令

根据端口获取相关信息

[root@iZ28t57xzbcZ ~]# lsof -i:80
COMMAND     PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd      1112   root    3u  IPv4  14258      0t0  TCP *:http (LISTEN)
AliYunDun  1135   root   23u  IPv4  14521      0t0  TCP iZ28t57xzbcZ:46292->140.205.140.205:http (ESTABLISHED)
httpd      6681 apache    3u  IPv4  14258      0t0  TCP *:http (LISTEN)
httpd      6682 apache    3u  IPv4  14258      0t0  TCP *:http (LISTEN)
httpd      6683 apache    3u  IPv4  14258      0t0  TCP *:http (LISTEN)
httpd      6684 apache    3u  IPv4  14258      0t0  TCP *:http (LISTEN)
httpd      6685 apache    3u  IPv4  14258      0t0  TCP *:http (LISTEN)
httpd      8061 apache    3u  IPv4  14258      0t0  TCP *:http (LISTEN)
httpd      8062 apache    3u  IPv4  14258      0t0  TCP *:http (LISTEN)
httpd     10230 apache    3u  IPv4  14258      0t0  TCP *:http (LISTEN)
httpd     11275 apache    3u  IPv4  14258      0t0  TCP *:http (LISTEN)
httpd     13635 apache    3u  IPv4  14258      0t0  TCP *:http (LISTEN)

[root@iZ28t57xzbcZ ~]# netstat -anp|grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN                                                                                              1112/httpd
tcp        0      0 121.42.151.190:80       218.4.117.14:48395      TIME_WAIT                                                                                           -
tcp        0      0 121.42.151.190:46292    140.205.140.205:80      ESTABLISHED                                                                                         1135/AliYunDun
unix  2      [ ]         DGRAM                    9804     345/systemd-udevd

[root@iZ28t57xzbcZ ~]# ps -ef|grep httpd
root      1112     1  0 Sep17 ?        00:00:24 /usr/sbin/httpd -DFOREGROUND
apache    6681  1112  0 Sep20 ?        00:00:33 /usr/sbin/httpd -DFOREGROUND
apache    6682  1112  0 Sep20 ?        00:00:19 /usr/sbin/httpd -DFOREGROUND
apache    6683  1112  0 Sep20 ?        00:00:38 /usr/sbin/httpd -DFOREGROUND
apache    6684  1112  0 Sep20 ?        00:00:22 /usr/sbin/httpd -DFOREGROUND
apache    6685  1112  0 Sep20 ?        00:00:39 /usr/sbin/httpd -DFOREGROUND
apache    8061  1112  0 Sep20 ?        00:00:23 /usr/sbin/httpd -DFOREGROUND
apache    8062  1112  0 Sep20 ?        00:00:21 /usr/sbin/httpd -DFOREGROUND
apache   10230  1112  0 Sep21 ?        00:00:12 /usr/sbin/httpd -DFOREGROUND
apache   11275  1112  0 Sep22 ?        00:00:09 /usr/sbin/httpd -DFOREGROUND
apache   13635  1112  0 Sep22 ?        00:00:03 /usr/sbin/httpd -DFOREGROUND
root     14738 14693  0 11:09 pts/0    00:00:00 grep --color=auto httpd

AngularJS Directive 隔离 Scope 数据交互

什么是隔离 Scope

AngularJS 的 directive 默认能共享父 scope 中定义的属性,例如在模版中直接使用父 scope 中的对象和属性。通常使用这种直接共享的方式可以实现一些简单的 directive 功能。当你需要创建一个可重复使用的 directive,只是偶尔需要访问或者修改父 scope 的数据,就需要使用隔离 scope。当使用隔离 scope 的时候,directive 会创建一个没有依赖父 scope 的 scope,并提供一些访问父 scope 的方式。

为什么使用隔离 Scope

当你想要写一个可重复使用的 directive,不能再依赖父 scope,这时候就需要使用隔离 scope 代替。共享 scope 可以直接共享父 scope,而隔离 scope 无法共享父scope。下图解释共享 scope 和隔离 scope 的区别:

Alt text

代码范例

<div ng-controller="myCtrl">
          <hello uname="name">
              <div>this is content</div>
          </hello>

           <hello uname="{{name}}">
              <div>this is content</div>
          </hello> 
        </div>
var module=angular.module('myApp',[]);
        module.controller('myCtrl',['$scope',function($scope) {
            $scope.name = "Feng";
        }]);

        module.directive('hello',function() {
            return {
                restrict:"EA",
                replace:false,
                transclude:true,
                scope: {
                  name:"@uname"
                },
                template:'<div>hello {{name}}</div>'
            };
        });

浏览器显示:

    scope: {
             name:"@uname"
           }

注意 默认情况下someProperty在DOM中的映射是some-property属性。如果我们想显式
指定绑定的属性名@uname,否则name:”@”默认是name:”@name”;name表示在template中的表达式属性


var module=angular.module('myApp',[]);
        module.controller('myCtrl',['$scope',function($scope) {
            $scope.name = "Feng";
        }]);

        module.directive('hello',function() {
            return {
                restrict:"EA",
                replace:false,
                transclude:true,
                scope: {
                  name:"=uname"
                },
                template:'<div>hello {{name}}</div>'
            };
        });

浏览器显示

如果html不变,javascript中,scope属性值成”@”为”=”,那么控制台会报错,而且 不能正常显示结果

directive 在使用隔离 scope 的时候,提供了三种方法同隔离之外的地方交互。这三种分别是:

  • @ 绑定一个局部 scope 属性到当前 dom 节点的属性值。结果总是一个字符串,因为 dom 属性是字符串。

    @ 方式局部属性用来访问 directive 外部环境定义的字符串值,主要是通过 directive 所在的标签属性绑定外部字符串值。这种绑定是单向的,即父 scope 的绑定变化,directive 中的 scope 的属性会同步变化,而隔离 scope 中的绑定变化,父 scope 是不知道的。

  • = 通过 directive 的 attr 属性的值在局部 scope 的属性和父 scope 属性名之间建立双向绑定。

    = 通过 directive 的 attr 属性的值在局部 scope 的属性和父 scope 属性名之间建立双向绑定。
    意思是,当你想要一个双向绑定的属性的时候,你可以使用=来引入外部属性。无论是改变父 scope 还是隔离 scope 里的属性,父 scope 和隔离 scope 都会同时更新属性值,因为它们是双向绑定的关系。

  • & 提供一种方式执行一个表达式在父 scope 的上下文中。如果没有指定 attr 名称,则属性名称为相同的本地名称。

    & 方式提供一种途经是 directive 能在父 scope 的上下文中执行一个表达式。此表达式可以是一个 function。
    比如当你写了一个 directive,当用户点击按钮时,directive 想要通知 controller,controller 无法知道 directive 中发生了什么,也许你可以通过使用 angular 中的 event 广播来做到,但是必须要在 controller 中增加一个事件监听方法。
    最好的方法就是让 directive 可以通过一个父 scope 中的 function,当 directive 中有什么动作需要更新到父 scope 中的时候,可以在父 scope 上下文中执行一段代码或者一个函数。

参考链接:https://blog.coding.net/blog/angularjs-directive-isolate-scope?type=early