Oracle 11g R2静默安装

本文详细记录了在CentOS6.5_x64环境下通过静默方式安装Oracle 11g R2的过程,包括系统环境的准备、安装步骤及监听器配置等内容。

Oracle 11g R2静默安装


测试安装Oracle 11g R2静默安装安装,环境是vmware平台虚拟机。做个记录。
CentOS 6.5_x64安装Oracle 11g R2
一,下载地址
 http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
Oracle 11g 联机文档:
 http://www.oracle.com/pls/db112/homepage

二,系统要求
内存:1G(官方最低要求1G)
硬盘:40G(企业版安装所需4.29G和1.7G数据文件)

检查的命令
内存
# grep MemTotal /proc/meminfo
交换空间
# grep SwapTotal /proc/meminfo
磁盘空间
# df -ah

三,安装前系统准备
1、修改主机名
# sed -i "s/HOSTNAME=localhost.localdomain/HOSTNAME=oracledb/" /etc/sysconfig/network
# hostname oracledb

2、添加主机名与IP对应记录
 #vi /etc/hosts 
10.10.0.48    oracledb

3、关闭Selinux
# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config  
# setenforce 0

4、创建用户和组(root用户:创建Oracle安装组oinstall,数据库管理员组dba,及oracle用户)
#  
# groupadd -g 200 oinstall 
# groupadd -g 201 dba 
# useradd -u 440 -g oinstall -G dba oracle (主组oinstall,其它组:dba)
# passwd oracle   #(P)

5、修改内核参数(root用户:修改 /etc/sysctl.conf 文件,加上如下参数)
# vi/etc/sysctl.conf  #末尾添加如下 
net.ipv4.ip_local_port_range= 9000 65500 
fs.file-max = 6815744 
kernel.shmall = 10523004 
kernel.shmmax = 6465333657 
kernel.shmmni = 4096 
kernel.sem = 250 32000 100128 
net.core.rmem_default=262144 
net.core.wmem_default=262144 
net.core.rmem_max=4194304 
net.core.wmem_max=1048576 
fs.aio-max-nr = 1048576
# sysctl -p  #使配置生效

6、修改系统资源限制(root用户:修改 /etc/security/limits.conf 文件,加上下面的参数)
# vi/etc/security/limits.conf #末尾添加如下 
oracle  soft  nproc  2047 
oracle  hard  nproc  16384 
oracle  soft  nofile  1024 
oracle  hard  nofile  65536
7、修改用户验证选项(root用户下:修改/etc/pam.d/login文件加上如下参数)
# vi/etc/pam.d/login 
session    required    pam_namespace.so  #下面添加一条pam_limits.so 
session    required    pam_limits.so
8、修改用户配置文件(root用户下:修改/etc/profile文件加入如下参数)
# vi/etc/profile    #(如果做了第6步的limits.conf设置,这个设置就不需要了) 
if [ $USER ="oracle" ]; then
      if [ $SHELL = "/bin/ksh" ];then
          ulimit -p 16384 
          ulimit -n 65536 
      else
          ulimit -u 16384 -n 65536 
      fi
fi

9、创建安装目录及设置权限

# mkdir -p /opt/app/oracle/  
# chmod 755 /opt/app/oracle/  
# chown oracle.oinstall -R /opt/app/oracle/

10、设置oracle环境变量
使用oracle账户
#su - oracle
$ vi ~/.bash_profile 
#设置oracle
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
#export PATH=$PATH:$ORACLE_HOME/bin
export ROACLE_PID=ora11g
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

完成后执行:
$ env | grep ORA #查看环境变量是否完成
oracle@oracledb ~]$ env | grep ORA
ORACLE_BASE=/opt/app/oracle
ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1

四、安装Oracle
1、安装依赖包
# yum -y install  gcc gcc-c++ make binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-commonglibc-devel 
libaio libaio-devel libgcclibstdc++ libstdc++-devel unixODBC unixODBC-devel
2, 安装oracle
 # unzip Linux.x64_11gR2_database_1of2.zip
 # unzip linux.x64_11gR2_database_1of2.zip 
3, 图形界面安装(略,通常的生产环境是不安装图形界面的)
# xhost +  #使所有用户都能访问图形桌面 
# su –oracle 
#.~/database/runInstaller
输入接受一些安全问题的邮件地址

4,字符界面下安装oracle
  在/opt目录下 解压oracle软件
 $ unzip linux.x64_11gR2_database_1of2.zip
 $ unzip linux.x64_11gR2_database_2of2.zip

解压后得到database目录,其中包含response目录,该目录中有三个rsp文件,用来作为静默安装时的应答文件的模板。

 三个文件作用分别是:
db_install.rsp:安装应答
dbca.rsp:创建数据库应答
netca.rsp:建立监听、本地服务名等网络设置的应答

将db_install.rsp备份一份,在其基础上修改内容, 将create database段中内容设置好即可。
修改静默安装的配置文件
$ less /opt/database/response/db_install.rsp |grep -v "#"|grep -v "^$"
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracledb
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/opt/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/opt/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=ora11g
oracle.install.db.config.starterdb.SID=ora11g
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1500
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=oracle
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true    //一定要设为 true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=

开始静默安装
$ /opt/database/runInstaller -silent -force -responseFile /opt/database/response/db_install.rsp
[oracle@oracledb database]$ ./runInstaller -silent -force -responseFile /opt/database/response/db_install.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 165908 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 16383 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-01-29_03-35-32PM. Please wait ...[oracle@oracledb database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
   CAUSE: The Central Inventory is located in the Oracle base.
   ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-13014] Target environment do not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
   CAUSE: The Central Inventory is located in the Oracle base.
   ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-13014] Target environment do not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
 /opt/app/oracle/oraInventory/logs/installActions2015-01-29_03-35-32PM.log
The following configuration scripts need to be executed as the "root" user. 
 #!/bin/sh 
 #Root scripts to run

/opt/app/oracle/oraInventory/orainstRoot.sh
/opt/app/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
         1. Open a terminal window 
         2. Log in as "root" 
         3. Run the scripts 
         4. Return to this window and hit "Enter" key to continue

Successfully Setup Software.
安装完毕后会提示上述的信息,按照要求执行上述脚本即可
备注:[WARNING] 是需要安装一些i386 的包。查看log安装即可

五,配置监听程序
$ $ORACLE_HOME/bin/netca /silent /responseFile /opt/database/response/netca.rsp
[oracle@oracledb bin]$ $ORACLE_HOME/bin/netca /silent /responseFile /opt/database/response/netca.rsp

Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /opt/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Listener "LISTENER" already exists.
Oracle Net Services configuration successful. The exit code is 0
启动监控程序
$  /opt/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER
或$ORACLE_BADE//opt/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 30-JAN-2015 13:23:46

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /opt/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /opt/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /opt/app/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                30-JAN-2015 13:23:47
Uptime                    0 days 0 hr. 1 min. 3 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /opt/app/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
The listener supports no services
The command completed successfully

启动成功


静默dbca建库
oracle@oracledb]$ vim /opt/database/response/dbca.rsp
 GDBNAME = "ora11g.dg01"78 行 全局数据库的名字=SID+主机域名
SID="orcl" //149行 SID
 CHARACTERSET="AL32UTF8" //415行 编码
NATIONALCHARACTERSET="UTF8" //425行 编码

[oracle@oracledb response]$ $ORACLE_HOME/bin/dbca -silent -responseFile /opt/database/response/dbca.rsp
Enter SYS user password: 
  
Enter SYSTEM user password: 
 
sh: /bin/ksh: No such file or directory
sh: /bin/ksh: No such file or directory
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
57% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
74% complete
85% complete
96% complete
100% complete
Look at the log file "/opt/app/oracle/cfgtoollogs/dbca/ora11g/ora11g.log" for further details.

启动数据库
$ sqlplus / as sysdba  //as前有个空格

[oracle@oracledb ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 16 14:26:57 2015

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> start
SP2-1506: START, @ or @@ command has no arguments
SQL> startup
ORACLE instance started.

Total System Global Area 3290345472 bytes
Fixed Size                  2217832 bytes
Variable Size            1795164312 bytes
Database Buffers         1476395008 bytes
Redo Buffers               16568320 bytes
Database mounted.
Database opened.
SQL> 
使用show parameter;或者select table_name from dba_tables看看是否正常


启动监听
启动监听:lsnrctl start 
查看监听:lsnrctl status 
停止监听:lsnrctl stop

  
[oracle@oracledb ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-FEB-2015 14:45:01

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /opt/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /opt/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /opt/app/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-FEB-2015 14:45:02
Uptime                    0 days 0 hr. 1 min. 3 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /opt/app/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
The listener supports no services
The command completed successfully


报错排除
[oracle@oracledb database]$ ./runInstaller -silent -force -responseFile /opt/database/response/db_install.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 161383 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 16383 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-01-26_01-34-45PM. Please wait ...[oracle@oracledb database]$ [FATAL] [INS-32012] Unable to create directory.
   CAUSE: Either proper permissions were not granted to create the directory or there was no space left in the volume.
   ACTION: Check your permission on the selected directory or choose another directory.
[FATAL] [INS-32012] Unable to create directory.
   CAUSE: Either proper permissions were not granted to create the directory or there was no space left in the volume.
   ACTION: Check your permission on the selected directory or choose another directory.

error

[oracle@oracledb database]$ ./runInstaller -silent -force -responseFile /opt/database/response/db_install.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 165989 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 16383 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-01-26_03-18-11PM. Please wait ...[oracle@oracledb database]$ [FATAL] [INS-32015] The location specified for Oracle home Location is invalid.
   CAUSE: The specified location cannot be used for Oracle home Location. Either the specified location is not found on the system or is detected to be a file.
   ACTION: Specify a valid location for Oracle home Location.
[WARNING] [INS-32018] The selected Oracle home is outside of Oracle base.
   CAUSE: The Oracle home selected was outside of Oracle base.
   ACTION: Oracle recommends installing Oracle software within the Oracle base directory. Adjust the Oracle home or Oracle base accordingly.
[FATAL] [INS-32021] Insufficient disk space on this volume for the selected Oracle home.
   CAUSE: The selected Oracle home was on a volume without enough disk space.
   ACTION: Choose a location for Oracle home that has enough space (minimum of 4,397MB) or free up space on the existing volume.
   
   解决办法:
   检查了环境变量$ORACLE_BASE和$ORACLE_HOME发现两个路径均正常,没有发现任何异常

逐步从头排查,发现在文件./response/db_install.rsp中INVENTORY_LOCATION、ORACLE_BASE和ORACLE_HOME三个字段被配置成了相对路径



umask 022
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export PATH=$ORACLE_HOME/bin :$PATH:$HOME/bin


-rw-r--r--  1 oracle oinstall 5402 Aug 18  2009 welcome.html
[oracle@oracledb database]$ ./runInstaller -silent -force -responseFile /opt/database/response/db_install.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 165989 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 16383 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-01-26_05-56-45PM. Please wait ...[oracle@oracledb database]$ [FATAL] [INS-32015] The location specified for Oracle home Location is invalid.
   CAUSE: The specified location cannot be used for Oracle home Location. Either the specified location is not found on the system or is detected to be a file.
   ACTION: Specify a valid location for Oracle home Location.
[WARNING] [INS-32018] The selected Oracle home is outside of Oracle base.
   CAUSE: The Oracle home selected was outside of Oracle base.
   ACTION: Oracle recommends installing Oracle software within the Oracle base directory. Adjust the Oracle home or Oracle base accordingly.
[FATAL] [INS-32021] Insufficient disk space on this volume for the selected Oracle home.
   CAUSE: The selected Oracle home was on a volume without enough disk space.
   ACTION: Choose a location for Oracle home that has enough space (minimum of 4,397MB) or free up space on the existing volume.
A log of this session is currently saved as: /tmp/OraInstall2015-01-26_05-56-45PM/installActions2015-01-26_05-56-45PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location to a more permanent location.

报错,解决
$ sqlplus / as sysdba  报错如下:
[oracle@oracledb ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 16 14:21:24 2015
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
    *****解决办法
    [oracle@oracledb ~]$ echo $ORACLE_HOME
             /opt/app/oracle/product/11.2.0/db_1
    [oracle@oracledb ~]$ echo $ORACLE_SID

oracle_SID 为空
添加SID
[oracle@oracledb ~]$ export ORACLE_SID=ora11g
确认添加成功
[oracle@oracledb ~]$ echo $ORACLE_SID
ora11g

测试是否启动
[oracle@oracledb ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 16 14:26:57 2015

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> start
SP2-1506: START, @ or @@ command has no arguments
SQL> startup
ORACLE instance started.

Total System Global Area 3290345472 bytes
Fixed Size                  2217832 bytes
Variable Size            1795164312 bytes
Database Buffers         1476395008 bytes
Redo Buffers               16568320 bytes
Database mounted.
Database opened.
SQL>
正常,问题得到解决
还可以将ORACLE_SID等环境变量写入到系统profile中,但需要确保系统profile文件内容的有效

1
### 关于 Instagram API 和 Ins 相关技术的主题 Instagram API 是一种用于访问 Instagram 平台数据的应用编程接口,允许开发者获取用户信息、媒体内容以及其他相关资源。以下是关于如何使用 Instagram API 及其相关内容的技术说明。 #### 1. **Instagram API 的基本功能** Instagram 提供了一组 RESTful 风格的 API 接口,这些接口可以实现多种操作,例如授权认证、检索用户资料以及查询特定媒体的内容。具体的功能包括但不限于以下几种: - `GET /oauth/authorize`:此端点用于启动 OAuth 认证流程,使应用程序能够获得用户的许可来访问他们的数据[^1]。 - `GET /{user-id}`:通过该请求可获取指定用户的详细信息,比如用户名、个人简介等[^1]。 - `GET /{media-id}`:利用这个方法可以从 Instagram 获取某条媒体对象的具体详情,像图片链接或者视频文件地址。 #### 2. **Python 实现 Instagram 数据抓取** 对于希望基于 Python 构建解决方案的人来说,可以通过调用 Instagram Graph API 来完成一系列任务,例如下载帖子中的图像并存储至本地磁盘或云服务位置;同时还可以进一步处理所收集的数据集来进行统计分析与展示工作流图等形式的结果呈现[^2]。 ```python import requests def fetch_user_media(user_id, access_token): url = f"https://graph.instagram.com/{user_id}/media?fields=id,caption&access_token={access_token}" response = requests.get(url) if response.status_code == 200: return response.json() else: raise Exception(f"Error fetching media: {response.text}") data = fetch_user_media('your-user-id', 'your-access-token') print(data) ``` 以上脚本片段展示了怎样借助官方文档指导下的参数设置去提取某个账户下公开分享过的多媒体列表实例化演示[^2]。 #### 3. **其他语言的支持情况** 除了主流脚本语言外,在 Ruby 社区也有专门针对简化同类型社交网络服务平台交互逻辑而设计出来的第三方开源项目——即名为 *InstagramApi* 的 gem 库。它不仅提供了友好直观的方法签名定义方式让初学者快速上手实践案例学习之外还具备高度灵活性满足高级定制需求场景适用范围广泛适用于各类业务形态当中[^4]。 --- ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值